sunset timelapsed movie code
def sunset(picture):
for frameNumber in range(1, 50):
for pixel in getPixels(picture):
# Make the pixel less blue and green rather than more red
setBlue(pixel, getBlue(pixel) * 0.99)
setGreen(pixel, getGreen(pixel) * 0.99)
writePictureTo(picture, fileName(frameNumber))
# "Deliberate" error was to unindent previous line -- which would only write a single frame instead of all of them. Can you see why?
# Return a distinct file name for a frame with this number
def fileName(n):
if n >= 10:
stem = "sunset"
else:
stem = "sunset0"
number = str(n)
extension = ".jpg"
name = stem + number + extension
return getMediaPath(name)
Link to this Page