Project 6 Animation Scenes
Skip to end of metadata
Go to start of metadata

The task for this project was to create complete shapes using Zelle graphics and then to take these shapes and create a complex scene as a collection of the objects. One of the complex objects in the scene had to be animated by either moving or changing color.

To complete this task, I first needed to create two complex objects. I chose to do an ocean scene with a shark swimming in the water and a plane flying over the shark. To do this I created a document. In it, I made the plane, defining it as plane_init where it took an x, y, and scale. I did this for all of my definitions so my objects could be drawn at any location on the screen at any scale.  I first wrote code to draw a rectangle to represent the back of the plane. I colored this rectangle white using setFill. I then drew the body of the plane by creating an oval, defining the shape by giving two opposite points on the ellipse, and again using setFill to make it gray.  Finally I drew the wing. This was more complicated as it was a trapezoid. I drew it using the polygon function and giving it four points. I again used the setFill to color it white. I was able to combine all of these objects using append after drawing each shape. Append allowed me to add on to the shape to make it complex.  For my second object, I chose to make a simple shark, defining it as shark_init and once again giving it an x, y, and scale. The body of the shark is the product of the oval Zelle graphic.  The bottom half of the oval is cut off by drawing the ocean over the oval.  After using append, I then used the Zelle object polygon, which I used to make a triangle by giving it three points.  I put the triangle on top of the oval to resemble the shark's fin.  Finally, I used the Zelle circle, colored it black, and drew it over the oval to look like the shark's eye.  I then used append to add it to the object. Next I needed to create an animation function to make my complex objects move.  I did this with guidance from the examples that Stephanie provided us in lecture.  The parameter's that I used to animate my objects were the same for both. They were shapes, frame, win, wrap_around_from, wrap_around_to, start_at_frame. I used these parameters to make my objects appear on the screen, go to a location, move across the screen and when they arrive at a certain point, loop back around to the starting location. To complete the first piece of the project, I created a test function that created a window titled "ocean," drew my shark, plane, sky, and water, and quit when I clicked the screen.  Here is what part of this code looked like:

For the second half of the project, I needed to actually make my objects move.  I did this by first creating a new document called and importing the time, graphics, and component packages.  After this, I created my main function. In this function, I initialized the objects, put them in a list and drew them in the order that I wanted them to appear on the screen. Then I created a loop to animate the objects by again referring to Stephanie's lecture notes for guidelines. I also adjusted the speed in which the objects moved by looping over the time.sleep function. After this was completed, my objects flew and swam across the screen, looped back to their respective starting points and continued moving.  Here are some pictures of my objects moving (I was able to take these pictures by decreasing the speed in which they moved across the screen by manipulating time.sleep() ): ,
, ,

For my extension, I created an additional two complex objects to go along with my first two complex objects(the plane and the shark). My first complex object was the orange fish in the bottom left corner of the screen. To make this I used the Zelle rectangle function to draw a rectangle for the tail. I colored the tail orange using setFill. I then used the circle function and strategically placed it over the majority of the rectangle to make the rectangle look more like the fish tail. I filled the circle orange. Finally I used the circle function again to draw a small black circle to represent the fish's eye. This was very easy because I already had the circle function written for the fish's body and the location of the eye was very close to the center point of the fish's body. I used the append function to combine all of my simple shapes to make one complex object.
My second additional object was the treasure chest in the middle on the bottom of the screen. To make this, I first used the rectangle Zelle graphic to make the body of the chest. I centered it in the screen and setFill it to be brown. I then used two more rectangle functions, put them on the sides of the chest, and filled them as gold. Then, to make the lock on the chest, I used the Zelle circle graphic. I first started with the top of the lock positioned just above the center of the chest colored in gold. I then made  bigger gold circle, centered it more than the previous circle, and drew it over the majority of the existing part of the lock. This make the lock appear to have a latch on the top. Finally, I used the Zelle circle again to make the key hole. This was simply a black circle drawn over the center of the body of the lock. I used append after every simple shape to make the final definition of the whole chest one complex objet.

In this project, I learned how to use Zelle graphics to create both simple and complex shapes. My memory was then refreshed about creating complex scenes through using simple shapes to make complex shapes. I learned how to used the animate function to make objects move. I also learned how to do things such as wrapping the object back to a point on the screen and making an object increase or decrease speed by using time.sleep().