summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Okay <cbeok@protonmail.com>2020-08-12 17:42:05 -0500
committerColin Okay <cbeok@protonmail.com>2020-08-12 17:42:05 -0500
commit556bea4e18dc96d7207692076e66775e8246dc82 (patch)
tree43cf658747c278598c7b304a959ae9fff627c3b3
parentadf3fded3aa80adc2ae1d7fb9ab90ea3b157caf7 (diff)
removed dependency on my stupid lettuce lib
-rw-r--r--animise.asd2
-rw-r--r--animise.lisp12
-rw-r--r--easing.lisp2
-rw-r--r--package.lisp4
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