3 ;; animation-demo.lsp - demonstrate gs:move-tag for making animations
4 ;; and the mouse-wheel moving a text object
8 (load (append (env "NEWLISPDIR") "/guiserver.lsp"))
13 (gs:frame
'AnimationDemo
100 100 400 300 "Animation ~ 30 frames/sec, 5 pixel/step")
14 (gs:set-resizable
'AnimationDemo nil
)
16 (gs:set-background
'MyCanvas gs
:white
)
17 (gs:mouse-wheel
'MyCanvas
'mouse-wheel-action
)
18 (gs:add-to
'AnimationDemo
'MyCanvas
)
21 (gs:set-font
'MyCanvas
"Lucida Sans Oblique" 16 "plain")
22 (gs:draw-text
'T
"turn the mouse wheel to move this text" 20 Ty
)
23 (gs:fill-circle
'C
50 40 25 gs
:red
)
24 (gs:fill-circle
'C
30 20 15 gs
:black
)
25 (gs:fill-circle
'C
70 20 15 gs
:black
)
26 (gs:fill-circle
'C
50 48 6 gs
:yellow
)
28 (gs:set-visible
'AnimationDemo true
)
31 (define (mouse-wheel-action x y wheel
)
33 (gs:move-tag
'T
0 (* wheel wheel
(sgn wheel
)))
34 (gs:move-tag
'T
0 (* 5 wheel
)))
39 (while (gs:check-event delay
)
41 (gs:check-event delay
)
44 (gs:check-event delay
)
47 (gs:check-event delay
)
48 (gs:move-tag
'C -
5 0))
50 (gs:check-event delay
)
51 (gs:move-tag
'C
0 -
5))