;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; LOOP D LOOP
;;
;; Draws a red square and a blue square
;; constantly rotating (around different origins)
;; and resizing as they move away from their
;; original point of origin.
;;
;; NOTE: Maximize the graphics display for full effect
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define canvas (gfx:make-canvas 600 600))
(define *go* #t)
;; The loop function draws, scales
;; and then rotates the path incrementing
;; the x,y origin of the rotation for the next
;; callback and also incrementing the scaleing
;; value for the next callback.
(define loopdloop
(lambda (time path stroke fill x y scale)
(gfx:draw-path time canvas path stroke fill)
(gfx:scale-path time path scale scale *gfx:matrix-scale*)
(gfx:rotate-path time path 2 x y *degrees*)
(if *go*
(callback (+ time 1000) 'loopdloop
(+ time 3000) path stroke fill
(+ x .15) (+ y .15) (+ scale 0.00001)))))
;; simple stop function.
;; make sure you call this when you've had enough
;; otherwise loopdloop will run forever.
(define stop
(lambda ()
(set! *go* #f)))
;; Create a red square to rotate around an origin
;; of 50,50. Create a blue square to rotate around
;; an origin of 0,0
(define start
(lambda (time)
(set! *go* #t)
(loopdloop time (gfx:make-square 50 50 50)
(list 1 1 0.5 0.25)
(list .9 0 0.7 0.01)
50 50 1.0)
(loopdloop (+ time (* *second* 20))
(gfx:make-square 50 50 50)
(list 1 1 0.5 0.25)
(list 0.1 0 1 0.025)
0 0 1.0)))
(stop)
(start (now))