[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/dslide 935224a638 182/230: ! introducing peel animation
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/dslide 935224a638 182/230: ! introducing peel animation |
Date: |
Sun, 7 Jul 2024 19:00:35 -0400 (EDT) |
branch: elpa/dslide
commit 935224a638f00b8785646bac3fcb61d1066bb967
Author: Psionik K <73710933+psionic-k@users.noreply.github.com>
Commit: Psionik K <73710933+psionic-k@users.noreply.github.com>
! introducing peel animation
"Peels" an overlay off. Right now this is only added onto the item-reveal.
!needs refactor to push more of the logic into the animation functions and
to
support animation of with either regions or overlays arguments.
uses the keep-fill behavior of hiding using an overlay that makes text
match the
background color
Signed-off-by: Psionik K <73710933+psionic-k@users.noreply.github.com>
---
dslide.el | 58 +++++++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 43 insertions(+), 15 deletions(-)
diff --git a/dslide.el b/dslide.el
index a68a496d33..4b5bd3fb47 100644
--- a/dslide.el
+++ b/dslide.el
@@ -1203,27 +1203,30 @@ for `dslide-contents-map'."
;; TODO Overlay intersection could be consolidated for use in other actions.
(cl-defmethod dslide-forward ((obj dslide-action-item-reveal))
- ;; Item reveal / hide repeats in place, so we pass non-nil `goto-end' to
+ ;; Item reveal / hide repeats in place, so we pass a final t to
;; `dslide-section-next'.
(when-let* ((next-item (dslide-section-next obj 'item nil t)))
- ;; TODO ensure animation starts immediately
- (when dslide-slide-in-effect
- (dslide-animation-setup (org-element-property :begin next-item)
- (org-element-property :end next-item)))
- ;; Because the user might add items etc, and to avoid the need for
- ;; keys matching items to our overlays, we intersect overlays we are
- ;; managing with overlays found at point, which could include overlays
- ;; from some other action
- (mapc #'delete-overlay
- (seq-intersection (oref obj overlays)
- (overlays-at (org-element-property
- :begin next-item))))
+ (let ((item-overlays (seq-intersection (oref obj overlays)
+ (overlays-at (org-element-property
+ :begin next-item)))))
+ (oset obj overlays (seq-difference (oref obj overlays)
+ item-overlays))
+ (when dslide-slide-in-effect
+ (if (oref obj inline)
+ (mapc #'dslide-animation-peel item-overlays)
+ (dslide-animation-setup (org-element-property :begin next-item)
+ (org-element-property :end next-item))
+ ;; Because the user might add items etc, and to avoid the need for
+ ;; keys matching items to our overlays, we intersect overlays we are
+ ;; managing with overlays found at point, which could include
overlays
+ ;; from some other action
+ (mapc #'delete-overlay item-overlays))))
;; return progress
(oref obj marker)))
(cl-defmethod dslide-backward ((obj dslide-action-item-reveal))
(when-let ((previous-item (dslide-section-previous obj 'item)))
- (push (dslide-hide-element previous-item)
+ (push (dslide-hide-element previous-item (oref obj inline))
(oref obj overlays))
;; return progress
(oref obj marker)))
@@ -2164,9 +2167,21 @@ assumes the buffer is restricted and that there is a
first tree."
;; * Animation
+(defun dslide-animation-peel (overlay)
+ "Peel away and delete OVERLAY."
+ (let ((timer (timer-create))
+ (peel-rate (/ dslide-animation-duration
+ (max 1 (- (overlay-end overlay)
+ (overlay-start overlay))))))
+ (push timer dslide--animation-timers)
+ (push overlay dslide--animation-overlays)
+ (timer-set-time timer (current-time) peel-rate)
+ (timer-set-function timer #'dslide--animate-peel
+ (list timer overlay))
+ (timer-activate timer)))
+
;; TODO move respect for animation variables into this function
;; TODO Support non-graphical
-;; TODO Inline animation fallback, uncover text character by character.
;; TODO User-provided animation override function
(defun dslide-animation-setup (beg end)
"Slide in the region from BEG to END.
@@ -2215,6 +2230,19 @@ and the value of `point-max' should contain a newline
somewhere."
(line-height (+ initial-line-height (* lines fraction))))
(overlay-put overlay 'line-height line-height))))
+(defun dslide--animate-peel (timer overlay)
+ (let ((start (overlay-start overlay))
+ (end (overlay-end overlay)))
+ (setf (overlay-start overlay) (1+ start))
+ (when (= (1+ start) end)
+ (cancel-timer timer)
+ (setq dslide--animation-timers
+ (delq timer dslide--animation-timers))
+ ;; TODO evaporation?
+ (delete-overlay overlay)
+ (setq dslide--animation-overlays
+ (delq overlay dslide--animation-overlays)))))
+
(defun dslide--animation-cleanup ()
(while dslide--animation-timers
(cancel-timer (pop dslide--animation-timers)))
- [nongnu] elpa/dslide 40b4bfe353 147/230: multiple animation overlays, (continued)
- [nongnu] elpa/dslide 40b4bfe353 147/230: multiple animation overlays, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 91b8fcaf92 153/230: introducing dslide-deck-develop, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 64dc89cd0f 156/230: allow explicit 'none for slide action class, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 93585c9173 158/230: slide composition order change (soon to refactor), ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 00597b9770 155/230: customization reminders in the demo, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 77126167a3 159/230: remove extraneous method qualifiers, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 2ec658ec9e 162/230: reverse-in-place for children, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide a58a915104 163/230: understand progress from org elements, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 586082e591 165/230: set overlay initial height, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 6cf49d2625 181/230: Oh yeah, seq-find doesn't return the result, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 935224a638 182/230: ! introducing peel animation,
ELPA Syncer <=
- [nongnu] elpa/dslide 217ddbe03e 185/230: a bit better display behavior, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 3a77163b15 188/230: ! hide markup action, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 04b2888a52 192/230: Hide markup action hides affiliated keywords, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 7ae80ecdca 194/230: cleaning up light misinformation, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide df98f4e5c2 197/230: remove babel results, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide cdf8d97eb6 198/230: hide non-exporting babel, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide b95576d460 201/230: Remove flickering caused by animation float / int behavior mismatch, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 1f02a2dfc0 205/230: line noise, no-op changes, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide f2ef90a2bd 209/230: document various results / exports behaviors in babel demos, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 0326d4d115 217/230: Fix mode check for dslide-develop command, ELPA Syncer, 2024/07/07