From 556bea4e18dc96d7207692076e66775e8246dc82 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Wed, 12 Aug 2020 17:42:05 -0500 Subject: removed dependency on my stupid lettuce lib --- animise.asd | 2 +- animise.lisp | 12 ++++++++---- easing.lisp | 2 +- package.lisp | 4 +++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/animise.asd b/animise.asd index 401e39c..ab3ca38 100644 --- a/animise.asd +++ b/animise.asd @@ -6,7 +6,7 @@ :license "AGPLv3.0" :version "0.0.1" :serial t - :depends-on (#:lettuce #:trivia) + :depends-on (#:trivia #:alexandria) :components ((:file "package") (:file "easing") (:file "animise") diff --git a/animise.lisp b/animise.lisp index 4cb54ac..728ec60 100644 --- a/animise.lisp +++ b/animise.lisp @@ -111,6 +111,7 @@ :duration duration)) (defun in-sequence (t1 &rest tws) + "Run the provided tweens one after the other" (let ((seq (make-instance 'tween-seq :tweens (cons t1 tws)))) (correct-sequencing seq) seq)) @@ -118,12 +119,12 @@ (defun end-time (tween) "Some tweens dont have a duration ,and hence never end. NIL is returned to reflect this." - (let-when (dur (duration tween)) + (when-let (dur (duration tween)) (+ (start-time tween) dur))) (defun tween-finished-p (tween time) "Returns T if TWEEN is done running." - (let-when (end (end-time tween)) + (when-let (end (end-time tween)) (>= time end))) (defun add-to-group (group tween &key (offset 0)) @@ -131,13 +132,16 @@ start time becomes the GROUP'S start time and the OFFSET is ignored. Otherwise, TWEEN's start time is set to the start time of the GROUP modified by OFFSET." - (let-when (start-time (and (members group) (start-time group))) + (when-let (start-time (and (members group) (start-time group))) (setf (start-time tween) (+ offset start-time))) (push (members group) tween)) (defun as-group (tween &rest tweens) + "run the provided tweens in paralell (not actually, but + logically). That is, tweens in this group can be updated at the same + time." (make-instance 'tween-group :members (cons tween tweens))) ;;; Interface implementations for TWEEN class @@ -253,7 +257,7 @@ (on-complete thing))) (defmethod run-tween ((ob tween-seq) time) - (let-when (tween (or + (when-let (tween (or ;; find the first unfinished tween in the sequence (find-if-not (lambda (tween) (when (tween-finished-p tween time) diff --git a/easing.lisp b/easing.lisp index ef20a30..d63a4b1 100644 --- a/easing.lisp +++ b/easing.lisp @@ -6,7 +6,7 @@ (defun time-frac (start duration current) (let* ((end (+ start duration)) - (progress (max 0 (- end current)))) + (progress (max 0 (- end current)))) (- 1.0 (/ progress duration)))) (defmacro def-ease (name &rest body) diff --git a/package.lisp b/package.lisp index ae0361f..197b106 100644 --- a/package.lisp +++ b/package.lisp @@ -1,8 +1,10 @@ ;;;; package.lisp (defpackage #:animise - (:use #:cl #:lettuce) + (:use #:cl) (:import-from #:trivia #:match) + (:import-from #:alexandria + #:when-let) (:export ;; TWEEN CLASSES -- cgit v1.2.3