Question: This is Python done using JES Exercise #1 o Write a program wipeDiagonalAnimation(picture) which takes as input a picture and creates an animation of the

This is Python done using JES

Exercise #1

o Write a program wipeDiagonalAnimation(picture) which takes as input a picture and creates an animation of the provided picture being wiped (black) top left to bottom right with 45 degree diagonals. See the video for the desired effect.

  • Initialize all variables you may need.
  • Create a loop counting the diagonals. Use the dimension of the picture to determine the number of diagonals you need. Inside the loop draw a black diagonal with a loop or addLine. Note that the latter accepts negative values for the coordinates, which will make this exercise easier. Repaint your picture after a diagonal has been drawn.

Exercise #2

o Write a program wipeDiagonalTransition(pictureFrom, pictureTo) which takes as input two pictures and creates a transition from the first to the second top left to bottom right with 45 degree diagonals. See the video for the desired effect.

    • Initialize all variables you may need.
    • Create a loop counting the diagonals. Use the dimension of the picture to determine the number of diagonals you need. Note that once you know the x coordinate on a diagonal, the y coordinate is known since for every diagonal x+y is constant. Inside the loop use a second loop to copy the colors from pictureTo into your transition picture. Repaint your picture after a diagonal has been drawn.

Exercise #3

o Write a program wipeDoubleDiagonalAnimation(picture) which takes as input a picture and creates an animation of the provided picture being wiped (black) simultaneously top left to bottom right and bottom right to top left with 45 degree diagonals. See the video for the desired effect.

    • Initialize all variables you may need.
    • Create a loop counting the diagonals. Use the dimension of the picture to determine the number of diagonals you need. Inside the loop draw two black diagonals (one representing the top left to bottom right animation, and the other representing the bottom right to top left animation) with a loop or addLine. Note that the latter accepts negative values for the coordinates, which will make this exercise easier. Since you will be drawing to diagonals inside your main loop, that outer loop only needs to run through half as many iterations as in Exercise #1. Repaint your picture after a diagonal has been drawn.

Exercise #4

  • Write a program randomCirclesAnimation(picture, iterations) which takes as input a picture and the number of random circles to be drawn. Create an animation of black circles at random positions and random radii drawn on the provided picture. See the video for the desired effect.
    • Use import random before you start writing your program.
    • Initialize all variables you may need.
    • Create a loop counting the iterations. Inside this loop, use random.randint to create random coordinates x and y for the center of a circle, and a random radius between 1 and 20 pixels wide. Use addOvalFilled to draw the circles. This function will clip the filled circle automatically, so you do not have to worry about parts of the circle being outside your picture. Repaint your picture after a circle has been drawn.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!