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.
-
What kind of model is this animation using?
-
Write code for the draw handler.
-
Moving the mouse resets the circle to its original size, radius 25.
- Suppose the mouse handler is called
cleo
. What is the signature ofcleo
? - What line of code adds this mouse handler to the animation?
- 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.
- Write code for mouse handler.
- Suppose the mouse handler is called
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.
- Write the signature for
maxie
. - Write the code for the
maxie
.