diff options
author | Boutade <thegoofist@protonmail.com> | 2019-10-03 09:33:37 -0500 |
---|---|---|
committer | Boutade <thegoofist@protonmail.com> | 2019-10-03 09:33:37 -0500 |
commit | 0064ad32e4d9a872e16c69217751fae44abf28b6 (patch) | |
tree | a86684a2ea48a57a37b04975c00627c6d068abbc | |
parent | c58c86925f357bbad6496f54753f0f48e7fb21a7 (diff) |
added pause and animate functions
-rw-r--r-- | animise.lisp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/animise.lisp b/animise.lisp index 8dbb494..7103a0a 100644 --- a/animise.lisp +++ b/animise.lisp @@ -51,7 +51,7 @@ :initarg :target :initform (error "Must have a target")) (rounding - :initarg rounding + :initarg :rounding :initform t ) (setter) (accessor @@ -86,6 +86,20 @@ ;;; Some functions that use the protocol defined by the generics +(defun pause (duration &optional (start 0)) + (make-instance 'tween :target (list 0) :start-time start :duration duration + :accessor 'car :end-val duration :rounding nil)) + +(defun animate (target acc end &key (start 0) (ease #'linear) (rounding t) (duration 1000)) + (make-instance 'tween + :target target + :start-time start + :accessor acc + :end-val end + :ease-fn ease + :rounding rounding + :duration duration)) + (defun in-sequence (t1 &rest tws) (let ((seq (make-instance 'tween-seq :tweens (cons t1 tws)))) (correct-sequencing seq) @@ -238,7 +252,7 @@ (loop :for tw :in (members ob) :minimizing (start-time tw))) (defmethod (setf start-time) (val (ob tween-group)) - (unless (members ob) (error "Can't setf the start time on an empty group")) + (Unless (members ob) (error "Can't setf the start time on an empty group")) (let* ((old-start-time (start-time ob)) (offset (- val old-start-time))) (dolist (tween (members ob)) |