summaryrefslogtreecommitdiff
path: root/animise.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'animise.lisp')
-rw-r--r--animise.lisp11
1 files changed, 10 insertions, 1 deletions
diff --git a/animise.lisp b/animise.lisp
index 7103a0a..9f2eb0c 100644
--- a/animise.lisp
+++ b/animise.lisp
@@ -56,7 +56,11 @@
(setter)
(accessor
:initarg :accessor
- :initform (error "Must supply an accessor function"))))
+ :initform (error "Must supply an accessor function"))
+ (on-complete
+ :accessor on-complete
+ :initarg :on-complete
+ :initform nil)))
(defmethod initialize-instance :after ((tween tween) &key)
(with-slots (getter setter accessor) tween
@@ -151,6 +155,11 @@
(if rounding (round new-val) new-val)
target)))))
+(defmethod run-tween :after ((tween tween) time)
+ (when (and (on-complete tween) (tween-finished-p tween time))
+ (funcall (on-complete tween))
+ (setf (on-complete tween) nil)))
+
;;; Interface implementations for TWEEN-SEQ
(defmethod start-time ((ob tween-seq))