I have a tinter interactive animation program where i


Topic: Python - Tkinter

I have a Tinter interactive animation program where I should do a number of specific features. For example, a rotating sticks animation is already set. I have to add the following feature "Pressing "z" teleports a random stick to a random location."

PlanetMoons - Look at the interactive animation program below, then add the following features to it.

1) Even moons are red, odd moons are yellow. Start conting from 0, so the first moon is red. Do not assume there are exactly 3 moons: there could be more or less.

2) A mouse click teleports the planet to the location of the click.

3) "z" makes the last moon 10% faster; "x" makes it 10% slower; "c" inverts its rotation.

4) "a" creates a new moon that is 30 steps further away from the last moon, with initial angle 0 and initial speed 1; "s" deletes the last moon, but the very first moon can never be deleted.

5) "1" turns the planet green; "2" blue; "3" brown. The initial color of the planet is brown.''

6) The planet contains the text "CMU" centered on it.

7) If the mouse click is inside the planet, the planet is not teleported but it turns purple. Otherwise the planet is teleported to the click location.

8) "v" inverts the rotation of all the moons.

9) "r" resets the animation to the initial state.

10) "b" doubles the speed of the slowest moon (be careful with signs: for example, a moon with speed -5.0 is faster than than a moon with speed 2.0. You can use the function abs(x) to get the absolute value of a number x)

11) "n" makes the planet's radius 10 units larger, "m" makes it 10 units smaller. The planet can never become smaller than 10 units.

The distances of all the moons are also increased/decreased of the same amount. Make sure all the functionalities still work properly when the planet is bigger/smaller (like the detection of a click inside the planet).

12) Moons that are slower than 2.0 rad/s (in any direction) turn blue.

13) "d" slows down all the moons by 30%.

14) "f" switches the text inside the planet from "CMU" to "Qatar". Pressing "f" again switches it back to "CMU".

15) Clicking inside a moon makes the planet turn pink (and prevents it from being teleported). Hint: you can find the math formula to calculate the position of the moons in the redrawAll() function.

16) The background of the game is a black starry sky, with 20 stars randomly placed at the beginning of the game. To draw a star, use the provided function drawStar(x, y).

Rotating Sticks - Look at the interactive animation program below, then add the following features to it.

Note: You can assume the canvas is 600x400 pixels.

1) Sticks that rotate clockwise are blue, those that rotate counterclockwise are red.

2) Clicking the mouse makes all the sticks move 10% closer to the location of the click.

3) Pressing "z" teleports a random stick to a random location.

4) pressing "x" creates a new stick in a random location, with a random length between 50 and 150, initial angle 0, and random angular velocity between -5.0 and 5.0. Hint: random.random() returns a float between 0.0 and 1.0.

5) Pressing "c" merges the first two sticks. The resulting stick is located at the middle point between the two original sticks; its length is the average of the two original lengths; its angle and angular velocity are the average of those of the two original sticks. If there are fewer than 2 sticks in the game, "c" has no effect.

6) Pressing "v" aligns all the sticks horizontally to the middle line of the canvas, spaced uniformly. The order of the sticks doesn't matter.

7) Pressing "b" will draw a green closed polygonal line that joins the centers of all the sticks. Pressing "b" again will make it disappear.

SpringFlowers

Explore the interactive animation program below, then add the following features to it:

1) A counter at the top right corner of the screen shows the current number of flowers.

2) Clicking inside the ground creates a new random flower at the location of the click.

Hint: use the function createRandomFlower() (already written for you) and modify the flower that it returns. Then use the function addFlowerInOrder() (also already written for you) to place the new flower in the correct position in the flower list.

3) Pressing "z" makes all the current flowers that are not already withering start to wither. Hint: a flower starts to wither when its age reaches 80% of its lifespan.

4) Pressing "x" makes the smallest flower twice as big. Make sure that your program does not crash if there are no flowers in the game.

5) Pressing "v" deletes all the flowers that are not red or yellow.

6) Every time you press "c" the ground changes color. The color rotates in this order: "tan" -> "green" -> "black" -> "gray" -> "white" -> "tan"

7) Pressing "b" moves all the flowers horizontally 20 units to the right. If a flower falls outside the right margin of the screen (i.e., 800) it appears again at the left margin (i.e., 0).

8) Pressing "n" stops the automatic creation of new flowers; pressing "n" again resumes it.

9) Pressing "a" makes a yellow sun appear on the upper left corner of the screen. Pressing "a" again makes it disappear. The sun is a disc centered at (70, 70) and its radius is randomly selected between 20 and 60 when "a" is pressed.

10) Each flower has a third leaf on the left side. This leaf is attached at 1/3 of the height of the stem, and its size is the average of the size of the other two leaves.

11) Clicking on the sky makes clouds appear at the locations of the clicks. A function that draws one cloud is already written for you (look after redrawAll()).

12) Clicking on the sky makes clouds appear at the locations of the clicks. A function that draws one cloud is already written for you (look after redrawAll()).

13) A counter at the bottom right corner of the screen shows the total number of flowers that ever existed since the beginning of the game.

Attachment:- Assignment.zip

Request for Solution File

Ask an Expert for Answer!!
Python Programming: I have a tinter interactive animation program where i
Reference No:- TGS01668159

Expected delivery within 24 Hours