makeBasicMovie
def makeBasicMovie():
# making a 100 frames
for frame in range(1, 100 + 1):
canvas = makeEmptyPicture(500, 300)
# adding a background
addRectFilled(canvas, 1, 1, 500, 300, blue)
# adding the smaller rectangle and making it move horizontally by 5 pixels
#addRectFilled(canvas, frame * 5, 1, 50, 50, red)
# adding the smaller rectangle and making it move diagonally vertically by 5 pixels
#addRectFilled(canvas, 1, frame * 5, 50, 50, red)
# adding the smaller rectangle and making it move diagonally by 5 pixels
addRectFilled(canvas, frame * 5, frame * 5, 50, 50, red)
# writing the frames to your computer with the proper naming convention
if frame < 10:
writePictureTo(canvas, "frame00" + str(frame) + ".jpg")
if frame >=10 and frame < 100:
writePictureTo(canvas, "frame0" + str(frame) + ".jpg")
if frame == 100:
writePictureTo(canvas, "frame" + str(frame) + ".jpg")
# make the movie and plays it
movie = makeMovieFromInitialFile("frame001.jpg")
playMovie(movie)
Link to this Page