emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 14cd6ec: Make string-animate smoother


From: Stefan Kangas
Subject: master 14cd6ec: Make string-animate smoother
Date: Sat, 20 Nov 2021 07:15:43 -0500 (EST)

branch: master
commit 14cd6ec8d269415ad4c342580c53528ab1bb17b2
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Make string-animate smoother
    
    * lisp/play/animate.el (animate-total-added-delay): New defcustom.
    (animate-n-steps): Double the default value.  Use :type 'natnum'.
    (animate-string): Make the delay depend on the above new defcustom
    divided by the number of steps.
---
 lisp/play/animate.el | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lisp/play/animate.el b/lisp/play/animate.el
index 7eb1b27..f3c77b3 100644
--- a/lisp/play/animate.el
+++ b/lisp/play/animate.el
@@ -93,9 +93,17 @@
   (unless (eolp) (delete-char 1))
   (insert-char char 1))
 
-(defcustom animate-n-steps 10
+(defcustom animate-n-steps 20
   "Number of steps `animate-string' will place a char before its last 
position."
-  :type 'integer)
+  :type 'natnum
+  :version "29.1")
+
+(defcustom animate-total-added-delay 0.5
+  "Total number of seconds to wait in between steps.
+This is added to the total time it takes to run `animate-string'
+to ensure that the animation is not too fast to be seen."
+  :type 'float
+  :version "29.1")
 
 (defvar animation-buffer-name nil
   "String naming the default buffer for animations.
@@ -130,7 +138,7 @@ in the current window."
        ;; Make sure buffer is displayed starting at the beginning.
        (set-window-start nil 1)
        ;; Display it, and wait just a little while.
-       (sit-for .05)
+        (sit-for (/ animate-total-added-delay (max animate-n-steps 1)))
        ;; Now undo the changes we made in the buffer.
        (setq list-to-undo buffer-undo-list)
        (while list-to-undo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]