Trailing whitepace deleted.
[bpt/emacs.git] / lisp / play / animate.el
index ee0c070..3e72247 100644 (file)
@@ -2,6 +2,9 @@
 
 ;; Copyright (C) 2001 Free Software Foundation, Inc.
 
+;; Maintainer: Richard Stallman <rms@gnu.org>
+;; Keywords: games
+
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
@@ -129,5 +132,56 @@ in the current window."
     ;; will undo the "animate" calls one by one.
     (undo-boundary)))
 
-;;; animate.el ends here
+;;;###autoload
+(defun animate-sequence (list-of-strings space)
+  "Display strings from LIST-OF-STRING with animation in a new buffer.
+Strings will be separated from each other by SPACE lines."
+  (let ((vpos (/ (- (window-height)
+                   1 ;; For the mode-line
+                   (* (1- (length list-of-strings)) space)
+                   (length list-of-strings))
+                2)))
+    (switch-to-buffer (get-buffer-create "*Animation*"))
+    (erase-buffer)
+    (sit-for 0)
+    (setq indent-tabs-mode nil)
+    (while list-of-strings
+      (animate-string (car list-of-strings) vpos)
+      (setq vpos (+ vpos space 1))
+      (setq list-of-strings (cdr list-of-strings)))))
 
+;;;###autoload
+(defun animate-birthday-present ()
+  "Display Sarah's birthday present in a new buffer."
+  (interactive)
+  ;; Make a suitable buffer to display the birthday present in.
+  (switch-to-buffer (get-buffer-create "*Sarah*"))
+  (erase-buffer)
+  ;; Display the empty buffer.
+  (sit-for 0)
+  ;; Make sure indentation does not use tabs.
+  ;; They would confuse things.
+  (setq indent-tabs-mode nil)
+
+  (animate-string "Happy Birthday," 6)
+  (animate-string "Sarah" 7)
+
+  (sit-for 1)
+
+  (animate-string "You are my sunshine," 10 30)
+  (sit-for .5)
+  (animate-string "My only sunshine." 11 30)
+  (sit-for .5)
+  (animate-string "I'm awful sad that" 12 30)
+  (sit-for .5)
+  (animate-string "You've moved away." 13 30)
+  (sit-for .5)
+  (animate-string "Let's talk together" 15 30)
+  (sit-for .5)
+  (animate-string "And love more deeply." 16 30)
+  (sit-for .5)
+  (animate-string "Please bring back" 17 30)
+  (animate-string "my sunshine" 18 34)
+  (animate-string "to stay!" 19 34))
+
+;;; animate.el ends here