 |  |

 |
 |  |  |
 | Welcome to CS1315. Click on the python to add comments.
|  |
 |  |  |
|
This page removed for FERPA compliance
|
        |
sunset
# Take a picture and make it gradually appear warmer/darker, simulating sunset
# This takes a long while to run
def makeREMOVEDnsetMovie(pic):
for frameNumber in range(100): # 100 frames from 00 to 99
# A progress report to reassure us that the program really is working
printNow("Working on frame number " + str(frameNumber) + " of 100.")
# Make the frame warmer by a very small amount
# Since we are not copying the picture afresh for each frame, these color shifts
# will accumulate from frame to frame
amt = 0.99 # Experiment with this. REMOVEDer number will make sunset happen faster
for p in getPixels(pic):
setGreen(p, getGreen(p)*amt)
setBlue(p, getBlue(p)*amt)
# Write color-shifted picture as a frame for the movie
numerals = str(frameNumber)
if frameNumber < 10:
numerals = "0" + numerals
fileName = "sunset" + numerals + ".jpg"
writePictureTo(pic, getMediaPath(fileName))
Link to this Page