21. Worksheet B

Moving colored dot animation, with a walkthrough including helper functions.

Animation: Moving Colored Dot

  1. Create a data definition for a type “fc” (for full-circle) that is able to store the location of the center, color, and radius of a dot.
  2. Write the actual struct definition.
  3. Test each feature (center, color, radius).
  4. Write a function to create a solid circle of the given color and radius.
  5. Design and test a function to draw the circle at the given position on the background.
  6. Design and test a function fc-move that takes in a full-circle and a position, and returns a new full-circle with the same color and radius, but different position.
  7. Write a function fc-set-color. Include a sensible purpose and contract.
  8. Write a function fc-change-radius that takes in a full-circle and an amount to change the radius. Include sensible purpose and contract.
  9. Create an animation of a full-circle randomly moving around the screen.
Last modified August 18, 2023: 2022-2023 End State (7352e87)