From aeb013df855052aec8a5199f82d9725be6d99c1b Mon Sep 17 00:00:00 2001 From: Boutade Date: Fri, 18 Oct 2019 12:08:52 -0500 Subject: checking for completes in a sequence --- animise.lisp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'animise.lisp') diff --git a/animise.lisp b/animise.lisp index 232a6c1..4cb54ac 100644 --- a/animise.lisp +++ b/animise.lisp @@ -248,12 +248,19 @@ ;; (reverse-tween seq) ;; (car (tweens seq))))))) +(defun has-on-complete (thing) + (and (typep thing 'tween) + (on-complete thing))) (defmethod run-tween ((ob tween-seq) time) (let-when (tween (or ;; find the first unfinished tween in the sequence (find-if-not (lambda (tween) - (tween-finished-p tween time)) + (when (tween-finished-p tween time) + (when (has-on-complete tween) + (funcall (on-complete tween)) + (setf (on-complete tween) nil)) + t)) (tweens ob)) ;; otherwise apply any looping configuration on the sequence ;; and apply the tween that results -- cgit v1.2.3