aUCBLogo Demos and Tests / spirograph
to pen ;draw a line form the previos pen position to the actual one
newPos=pos
if not oldPos=="NA [setpos oldPos] ;except for the first time
setpos newPos
oldPos=newPos
end
to wheel t rb rs pen_ ;teeth, wheelRadius, dotRadius
bk rb ;go to the certer of the wheel
lt (360/t)*rotat
fd rs ;go to the dot position
run pen_
bk rs
rt (360/t)*rotat
fd rb
rotat=rotat+1
end
to ring t r outer wheel_ ;teeth, radius, useOuterBorder?, wheelToUse
rt 360/t
fd r
if outer [rt 180]
run wheel_
if outer [rt 180]
bk r
end
to drawing big small ;ringInnerTeeth, wheelTeeth
oldPos="NA
rotat=0
pu
setpencolor 3
repeat big*small/(gcd big small)
[
ring big 70 "false
[ setpencolor 4
wheel small 25 22
[ pd
; setpensize [2 2] setpencolor 12
pen
; setpensize [1 1] setpencolor 4
pu
]
setpencolor 3
]
]
end
to spirograph
ht
foreach [24 30 32 36 40 42 45 48 50 52 56 60 63 64 72 75 80 84]
[ pu
setxy (remainder (#-1) 6)*130-330 200-(int (#-1)/6)*150
pd
drawing 105 ?
updateGraph
]
end