Starting from:

$20

Project 4: Animation

Clases (shape.py) Superclass Shape class is the "superclass" of all of the graphic element classes. That means they all "inherit" all of the methods from this class, and can all be treated as Shapes. Subclasses Circle, line, and triangle are classes "derived" from the Shape class. This means that, though they have their own identity, they can be used as Shapes when it's convenient. For example, our GO class stores a collection of Shapes, and we don't have to specify exactly what KIND of Shape each is. It is customary to say that derived classes, like circle, line, and triangle, possess an "is-a" relationship with the base class (Shape). That is, we can say a circle is a Shape, a line is a Shape, and a triangle is a Shape. Shape All the functions for shape has been completed. Circle All the functions for circle has been completed. · __init__(self, center, radius, thickness, color) · isPointOnCircle(self, point): · draw(self, im): Please look at the circle constructor carefully, because we're going to ask you to write the constructors for the other two Shape classes. Line You have to write the constructor. · __init__(self, pt1, pt2, color) The other function has been completed. · draw(self, im) Triangle You have to write the constructor and the draw function. · __init__(self, pt1, pt2, pt3, color, isFilled = False) · draw(self, im) The other functions have been completed. · sort3Pts(self) · drawFilledTriangle(self, im) · drawTriangle(self, im) You also have to write isPointInImage(point, imSize) which checks if the point lies within the dimensions of the given image. Required Tasks Here's a brief list of the things you need to do for this project. More details follow in the sections below. 1. Download the following files: movie.py, shape.py, test.py, quad.jpg, image_display.py, sunflowers.jpg 2. Complete the methods in the movie.py and shape.py 3. Do initial testing with test.py file. 4. Test your code by making a movie using the script moviestarter.py. 5. Upload your files (movie.py, shape.py) Functions (90 Points) You must write all the following methods, which are defined more carefully in movie.py and shape.py. In movie.py o movie.addImage(newImage): adds an image to the movie o scene.__init__(): the frame class constructor o scene.addGO(newGO): adds a graphics object to a frame o scene.drawSceneBG(bg): draws all the objects in a frame on a copy of a given image and returns the new image. o scene.drawSceneColorSize(color, size): creates a new canvas of a given color and size, draws the frame's objects on it, and returns the image o GO.__init__(): the GO class constructor o GO.addShape(newShape): adds a given shape to the GO o GO.render(img): takes an image and draws the GO on it In shape.py o line.__init__(): the line class constructor o triangle.__init__(): the triangle class constructor o triangle.draw(im): draw the triangle on the given image o isPointInImage(image, imSize): returns true if the given point is on the given image, false otherwise. We have written a lot of functions for you. Please check what they do, especially the ones used for transformation: · GO.translate(overUp): given input (over,up) slides a GO by over horizontally, and by up vertically · GO.scale(factor): scales the GO by a factor · GO.rotate(angle, center): rotates a GO by a given angle and around a given center Documentation (10 Points) When you run moviestarter.py, the following should happen: 1. You should see a girl entering the screen 2. After the girl enters the screen, she will let go of the balloon Click on the link below to see a screen capture of the short movie...your code should produce something that looks very similar. girlDemo.gif

More products