summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoutade <thegoofist@protonmail.com>2019-10-05 11:42:01 -0500
committerBoutade <thegoofist@protonmail.com>2019-10-05 11:42:01 -0500
commit2efa1797e674dcb82b2e5f619be7f8056c183ba2 (patch)
treed329b915a5311bae9ce187dcf3474df4dfd3fc48
parent71ddab615686666ffe88a217530ff02f0c662f3b (diff)
second example to readme
-rw-r--r--.images/eg1.gifbin0 -> 107677 bytes
-rw-r--r--README.org37
2 files changed, 37 insertions, 0 deletions
diff --git a/.images/eg1.gif b/.images/eg1.gif
new file mode 100644
index 0000000..21e78b0
--- /dev/null
+++ b/.images/eg1.gif
Binary files differ
diff --git a/README.org b/README.org
index ec07288..9d05f77 100644
--- a/README.org
+++ b/README.org
@@ -37,4 +37,41 @@ And here is what the above looks like
[[.images/animise-eg-3.gif]]
+*** Another example
+[[.images/eg1.gif]]
+
+#+begin_src lisp
+
+ (let* ((rect (sdl2:make-rect 0 0 100 100))
+ (dur 2200)
+ (dur/3 (round (/ dur 3)))
+ (anim
+ (sequencing (:loop-mode :looping :targeting rect)
+ (grouping (:for dur)
+ ;; only the first member of a sequence needs a real start time
+ (animating :elastically-out :starting (sdl2:get-ticks) :the 'sdl2:rect-x :to 500)
+ (animating :quading-out :the 'sdl2:rect-height :to 20)
+ (animating :quading-out :the 'sdl2:rect-width :to 20))
+ (grouping (:for dur)
+ (animating :quading-out :the 'sdl2:rect-width :to 100)
+ (animating :quading-out :the 'sdl2:rect-height :to 100)
+ (animating :bouncing-out :the 'sdl2:rect-x :to 0))))
+ (other-anim
+ (sequencing (:targeting rect :loop-mode :looping)
+ ;; again, first member of a sequence
+ (animating :quading-in-out :the 'sdl2:rect-y :to 150 :for dur/3 :starting (sdl2:get-ticks))
+ (animating :quading-in-out :the 'sdl2:rect-y :to 0 :for dur/3))))
+
+#+end_src
+
+Then to update each of the animations `anim` and `other-anim`, the above calls
+
+#+begin_src lisp
+
+ (animise:run-tween anim (sdl2:get-ticks))
+ (animise:run-tween other-anim (sdl2:get-ticks))
+
+#+end_src
+
+before the start of the rendering step.