[plt-scheme] I miss end-of-time...

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Mar 11 16:11:40 EST 2010

On Mar 11, 2010, at 2:34 PM, Stephen Bloch wrote:

> Try this: write an animation of a disk whose radius starts at 0 and  
> grows by 1 pixel per second.  The animation stops when the user  
> presses any key on the keyboard.

Here it is:

;; ISL+
(require 2htdp/universe)
(require 2htdp/image)

(big-bang 100
           (on-tick sub1)
           (on-draw (lambda (n) (circle (+ n 1) 'solid 'red)))
           (stop-when negative? (lambda (n) (text "stopped" 11 'red)))
           (on-key  (lambda (n key)
                      (if (key=? key "k") -1 n))))

  
                         


Posted on the users mailing list.