(define (tick) (* 3000000 (get-internal-real-time)))
(define (waggle) (* 200 (cos (* pi (tick)))))
(define (wiggle) (* 300 (sin (* pi (tick)))))
+(define (swaggle) (cos (* pi (tick))))
+(define (swiggle) (sin (* pi (tick))))
-(define left-right-homer
- (move (image "homer.png")
- wiggle 0))
+(define homer (image "homer.png"))
+(define marge (image "marge.png"))
-(define up-down-marge
- (move (image "marge.png")
- 0 waggle))
+(define (hv-dance image1 image2)
+ (over (move image1 wiggle 0)
+ (move image2 0 waggle)))
+
+(define homer-marge-dance
+ (hv-dance homer marge))
+
+(display-scene
+ (window ((resolution '(640 480)))
+ homer-marge-dance))
+
+(display-scene
+ (window ((resolution '(640 480)))
+ (let ((small (scale homer-marge-dance 0.5)))
+ (hv-dance small small))))
+
+(display-scene
+ (window ((resolution '(640 480)))
+ (scale homer-marge-dance (lambda () (abs (swiggle))))))
+
+(display-scene
+ (window ((resolution '(640 480)))
+ (hv-dance (scale homer swiggle)
+ (scale marge swaggle))))
(display-scene
(window ((resolution '(640 480)))
- (over left-right-homer
- up-down-marge)))
+ (over (scale homer swiggle)
+ (move marge wiggle waggle))))