blob: f47c1d47581d34008550f579ef8f873ec9250bee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
* Animise
/General purpose tweens and easing/
Animise is a small library that you may use to orchestrate any time-varying
numerical values. While animise is intended to be used as a general purpose
[[https://en.wikipedia.org/wiki/Inbetweening][tweening]] solution for your Common Lisp projects, you could use it for other
purposes as well (e.g. modulating audio signals).
Here is a short example using animise to define an animated a box using SDL2
#+begin_src lisp
;; ... snip
(let* ((rect (sdl2:make-rect 0 0 100 100))
(color (list 255 0 0 255))
(anim (sequencing (:loop-mode :looping :targeting rect)
(pausing :for 200 :start (sdl2:get-ticks))
(grouping (:with-duration 1200)
(animating :linearly :the 'cadddr :of color :to 0)
(animating :quading-out :the 'sdl2:rect-x :to 400)
(animating :bouncing-out :the 'sdl2:rect-y :to 300))
(grouping (:with-duration 1000)
(animating :linearly :the 'cadddr :of color :to 255)
(animating :elastically-out :the 'sdl2:rect-x :to 0))
(animating :cubically-in-out :the 'sdl2:rect-y :to 0 :for 800))))
;; ... snip
#+end_src
And here is what the above looks like
<img src="images/animise-eg-3.gif" width="272" height="223"/>
|