big-bang 05

Setting (and resetting) animations to a given state.

A

(define (more n) (+ n 5))
(big-bang 25
  (on-tick more 0.2)
  (on-draw work))

You want to see an animation of a solid blue circle increasing in radius in the center of a 400x300 black outline rectangle.

  1. What kind of model is this animation using?

  2. Write code for the draw handler.

  3. Moving the mouse resets the circle to its original size, radius 25.

    1. Suppose the mouse handler is called cleo. What is the signature of cleo?
    2. What line of code adds this mouse handler to the animation?
    3. Write a check-expect for the mouse handler showing that when the (old) radius is 75 and the mouse is moved to (210, 80), the radius resets to 25.
    4. Write code for mouse handler.

B

An alternate version.

(define (draw-h img) (overlay img (rectangle 400 300 "solid" "purple")))
(define (biggr img) (scale 1.02 img))
(big-bang (circle 25 "solid" "yellow")
  (on-tick biggr 0.2)
  (on-draw draw-h)
  (on-mouse maxie))

Again, suppose you want maxie to reset the circle to its original size when called.

  1. Write the signature for maxie.
  2. Write the code for the maxie.
Last modified August 18, 2023: 2022-2023 End State (7352e87)