Jonathan's CS151 Project 6
Skip to end of metadata
Go to start of metadata

Overview:

The purpose of this project was to go back to drawing shapes on the screen, with a twist. This time, we needed to make some part of our scene animate, whether shapes are moving or changing colors. We learned how to do this by coding the shapes to change after a certain number of frames. First, I started by creating shape groups for my scene. I did this by using the graphics plus file, and taking codes for different shapes off of that. The first shapes that I created was a bunch of rectangles, colored differently and positioned differently to look like a city skyline. Below is a snippet of my code:
The addition of the scale command allowed me to be able to place my entire building function at different places and different sizes all along the screen. I did this with all three of my shape group functions. Below are images that show that my shape groups are successfully scaled:

These are the three shape groups that together, in the right position, create my downtown scene. Below is what my downtown scene looks like put al together:

The next task for project 6 was to have some aspect of my scene animate. I decided to take my streetlights and have them change colors. In order to do this, I made a for loop that set a random color value for all three circles, and had it reassign the color of the circle to that value. Next, I put a for loop in the main code that would go through the streetlight for loop 200 times, making sure there was the command time.sleep(0.25) in the code. The time.sleep command pauses the running of the function for a quarter of a second, which is crucial in making a smooth animation. Below are three images of my scene changing the color of the streetlights to random colors:

Extensions:
For my extension, I added an additional animation to my downtown scene. Because I thought it was fitting, I added the steam plant building to my scene. In order to get the steam function working properly, and at the same time as my streetlight animation, I needed to combine the two for loops. Once I did that, the two animations worked at the same time, producing the below scene:

What I learned: I feel like this project was extremely important, as we took a big step from drawing still images on the screen to producing animations that can produce a moving scene. During this project, I learned how to interact with frame numbers, and the time functions. These are essential pieces of information to use as they really help make a great animation. 
Acknowledgements: Prof. Taylor, Holly Olsen

Labels