Microsoft Word - finalProject2.docx Object-Oriented Programming ENGG*1420, Winter 2022 Project Subject: Animation Player Project Description: You are asked to write a program that reads information...

1 answer below »
The project is attached to the order in the pdf


Microsoft Word - finalProject2.docx Object-Oriented Programming ENGG*1420, Winter 2022 Project Subject: Animation Player Project Description: You are asked to write a program that reads information about an animation file from a .txt file, the format of which is described below, and then executes that animation based on that information. Each animation has several frames, each of which shows a scene from the animation. Each animation has a specific playback speed, such as 10 frames per second, which determines how fast (at what time intervals) the animation frames are displayed. In each frame, based on what is specified in the input file, the elements are displayed graphically in a window, and the window ends when the last frame is executed. The input file not only identifies the elements in the animation, but also the effects that must be executed on each of these elements at a given time. The main part of your program (main method) is expected to look something like the following: AnimationPlayer player = new AnimationPlayer(); player.loadAnimationFromFile("animation1.txt"); player.run(); In the above code snippet, the first row creates an AnimationPlayer object, the second row loads the animation information from the input .txt file, and the third row runs the animation. The size of the animation window is fixed during the animation run. For example, the window size of an animation may be 400 pixels by 300 pixels. The animation window has a background color that is also fixed during the animation run. Each animation has a series of elements. Each element contains a shape and a number (zero or more) of effects, which are executed in a specific order during the animation. Shapes Your application should support the following types of shapes: • Circle: Each circle has a radius (r), the color inside the circle (color), the coordinates of the center of the circle (including x and y), the thickness of the border of the circle (border) (in pixels) and the color of the border of the circle (borderColor). Object-Oriented Programming ENGG*1420, Winter 2022 • Rectangle: Each rectangle has a length and width, color inside the rectangle (color), coordinates of the left and top corners of the rectangle (x and y), border thickness (border) (in pixels) and border color (borderColor). • Line: Each line has a starting point (including startX and startY) and an end point (including endX and endY), color, and border thickness (border). In the above description, color consists of 3 components: the amount of red R, the amount of green G, and the amount of blue B. Effects Your application should support the following types of effects: • Hide: When this effect is applied to an object, that object is hidden (it is not removed from the animation window). Each instance of this effect contains the following information: The frame number in which this effect is executed (i.e., start) • Show: When this effect is executed on an object, that object is displayed. Each instance of this effect contains the following information: The frame number in which this effect is executed (i.e., start) • Jump: When this effect is executed on an object, that object is immediately transferred to a new position. Each instance of this effect contains the following information: the frame number in which the effect is executed (i.e., start), the coordinates of the position to which the object is transferred (i.e., x and y) • ChangeColor: When this effect is applied to an object, the color of that object changes immediately. Each instance of this effect contains the following information: the frame number in which this effect is executed (i.e., start), the new color of the shape (e.g., for the circle, it is the color inside the circle and for the line, it is the color of the line itself). Input File Format The input file that contains the animation information is a text file. The first row of this file has the following format: frames: ### where ### is an integer that specifies the total number of animation frames. Object-Oriented Programming ENGG*1420, Winter 2022 The second line has the following format: speed: ### fps where ### is an integer that specifies the speed of the animation (fps: frames per second) In the next line, the number of elements in the animation is mentioned, which is an integer. Then, in the following lines, the information of each element is mentioned. Thus, there is a blank line between the information for each element. The information of each element is also mentioned in the file in such a way that in the first line, the type of the object is written and in each of the next rows, one of the attributes of the object is written along with its value. After introducing the properties, the effects of that object are mentioned. The information in each effect starts with a line containing the word effect. In the next line, the type of effect, and in the next lines, the properties of that effect are mentioned. Note that for each object, it is not necessary that the value of all its attributes be listed in the input file. For each attribute whose value is not specified, consider an appropriate default value. To understand the structure of the input file, look at the table below, which shows the contents of a sample input file and describes each row. Description Row This animation has 1000 frames. frames: 1000 The speed of this animation is 10 frames per second (10 fps) speed: 10fps This animation consists of 3 elements 2 A blank line means that in the next lines, the information of an element is mentioned. The first element is an object of type Circle. Circle The radius of the circle is equal to 10 pixels r: 10 The value of the x coordinate of the center of the circle is 50. x: 50 The value of the y coordinate of the center of the circle is 50. y: 50 The color inside the circle is red (R: 255, G:0, B: 0) color: 255, 0, 0 Start introducing an effect for this circle effect Object-Oriented Programming ENGG*1420, Winter 2022 Description Row This effect is of Show type Show This effect is executed in frame number 10 (i.e., when the animation execution reaches frame number 10, this circle is displayed. Before that, the circle is hidden) start: 10 Start introducing another effect for this circle effect This effect is of type Hide. Hide This effect is executed in frame number 120 (i.e., when the animation execution reaches frame number 120, this circle is hidden) start: 120 A blank line indicating the circle information is finished. The second element is a rectangular object. Rect The length of the rectangle is 100 pixels. length: 100 The width of the rectangle is 50 pixels. width: 50 The value of x coordinate of this rectangle is 25. x: 25 The value of y coordinate of this rectangle is 25. y: 25 The thickness of the border of this rectangle is 5 pixels. border: 5 Start introducing an effect for this rectangle. effect This effect is of Show type. Show This effect is executed in frame number 15 (when the animation execution reaches frame number 15, this rectangle is displayed. It is already hidden) start: 15 Start introducing another effect for this rectangle. effect This effect is of Jump type. Jump This effect is executed in frame number 50 (when the animation execution reaches frame number 50, this rectangle is moved to the new position) start: 50 The value of the x coordinate of the new position of the rectangle is 30 x: 30 The value of the y coordinate of the new position of the rectangle is 30 y: 30 A blank line indicating the information of the rectangle is finished. Important Points • Each group needs to create a GitHub repository for the project. The teammates need to work on the project via contributing to the GitHub repository. Object-Oriented Programming ENGG*1420, Winter 2022 • You need to use object-oriented concepts (e.g., inheritance, polymorphism, abstract classes and methods and interfaces). • The program must be resistant to some errors in the input file. For example, if there was a line in the input file with inappropriate information, the program should not crash or stop, but can skip that line. For this purpose, proper use of exception handling techniques is essential. • Generate Javadoc documentation for your project • The project delivery is in-person, and it will be during the last session of the lab • During the project delivery, each of the teammates will be asked to change and describe a part of the code. • The project will be 25% of the final grade.
Answered 27 days AfterMar 03, 2022

Answer To: Microsoft Word - finalProject2.docx Object-Oriented Programming ENGG*1420, Winter 2022 Project...

Shweta answered on Mar 30 2022
98 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here