Skip to content

Assignment

Review the previous contents.

Question 1

Create the image below according to the guidance.

  1. Draw a lattice using a for loop
  2. Make 1/4 of the shape. Pay attention to the start and end points of the lines.
  3. Create the same shape at all four corners
  4. Color the lines to look nice.

Question 2

Create an image like the one below by placing many small circles on a large orbit.

Question 3

Create the following animation. The details of the movement can be different, as long as the circles move back and forth and are larger in the center.

  1. First, create a circle that goes back and forth. The following methods are possible.
    • Use trigonometric functions to create periodic motion.
    • Or, move the circle slightly each frame and reverse the direction of movement when it reaches the edge.
  2. Next, we can change the size of the circle by mapping the x-coordinate to the radius.

The basics of animation were covered in Part 2.

Question 4

Create a program that draws one rectangle on the screen and changes color while the cursor is on it. If you have time, try to do it in a circle.

  • Use system variables to get the cursor position.
  • Use the position of the rectangle, the lengths of its edges, and the position of the cursor to define the conditions for the different colors.