MIC
Pat O'Sullivan
Department of Mathematics and Computer Studies
Mary Immaculate College, Limerick, Ireland

General Information

Student Resources and Information

Interests

Motion

The basic ingredient in making a shape appear to move is to make sure that the shape procedure is state transparent and then repeat something like:
shape wait ? pe shape ppt move
The input for wait is optional and determined by the required speed of the motion and flicker reduction.

This (apart from the repetition) is produced by:
to mshape1

cs rt 90
repeat 90 [tri wait 2 pe tri ppt pu fd 1 pd]
tri

end
to tri

repeat 3[fd 20 rt 120]

end


Of course the motion does not have to be in a straight line or a circle the following "bouncing ball" has a zig-zag motion:


This (apart from the repetition) is produced by:

to mshape2
cs
pu bk 9 rt 90 pd fd 220 pu home     ;draws the "floor"
fd 23 rt 90 pd fd 220 pu home pd     ;draws the "ceiling"
rt 45 circ
repeat 5[ repeat 5 [circ wait 2 pe circ ppt pu fd 6 pd] rt 90 repeat 5 [circ wait 2 pe circ ppt pu fd 6 pd] lt 90 ]

end
to circ

repeat 30 [fd 1 rt 12]

end
Have a go at: