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

General Information

Student Resources and Information

Interests

Animated Gifs

Bubbles:

The basic procedure here repeats the sequence

draw circle, wait, clean, move turtle a bit, draw a bigger circle

The first procedure circ :r :y puts the turtle into a position with y coordinate :y and then draws a circle of radius :r using the logo circle command rather than writing our own procedure for a circle.

to circ :r

pu sety :y pd     ;move the turtle to a position with y coordinate :y    
circle :r     ;draw a circle of radius :r

end
to bubbles

make "r 1     ;make the radius of the first circle 1
make "y -200     ;make the initial y coordinate -200
repeat 30[ circ :r :y wait 4 clean make "r :r+1 make "y :y+10]
    ;draw circle, wait, clean,
    ;increase radius, increase y coordinate

end

Now the animated gif is produced by inserting the gifsave command in appropriate places with the appropriate inputs.

to bubbles

make "r 1
make "y -200
(gifsave "bubbles.gif 0 "false 0)
repeat 30[ circ :r :y (gifsave "bubbles.gif 0 "true 0) wait 4 clean make "r :r+1 make "y :y+4]


end

Tube:


The basic tube procedure is virtually the same as the bubble procedure except that the clean command is omitted.

to tube

make "r 5
make "y -100
repeat 30[circle :r :y wait 4 make "r :r+1 make "y :y+4]

end

We then insert the gifsave command as usual:

to tube

make "r 5
make "y -100
(gifsave "tube.gif 0 "false 0)
repeat 30[circle :r :y wait 4 (gifsave "tube.gif 0 "true 0) make "r :r+1 make "y :y+4]

end

 
Department Home
Home
The information found on personal pages should not be considered official material from Mary Immaculate College and the College does not accept any responsibility for its accuracy or otherwise.