Created
December 20, 2010 15:25
-
-
Save kiwanami/748502 to your computer and use it in GitHub Desktop.
animation on emacs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'concurrent) | |
(defun make-svg (num) | |
(let ((op (/ num 20.0)) | |
(tmp | |
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" | |
\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"> | |
<svg width=\"200\" height=\"200\" xmlns=\"http://www.w3.org/2000/svg\"> | |
<filter id=\"Blur\" > | |
<feGaussianBlur stdDeviation=\"%BL%\"/> | |
</filter> | |
<g filter=\"url(#Blur)\"> | |
<image x=\"0\" y=\"0\" width=\"200px\" height=\"200px\" | |
opacity=\"%OP%\" | |
xlink:href=\"some.jpg\"> | |
<title>an image</title> | |
</image> | |
</g> | |
</svg>")) | |
(replace-regexp-in-string | |
"%BL%" (format "%s" (* 4.0 (- 1.0 op))) | |
(replace-regexp-in-string "%OP%" (format "%s" op) tmp)))) | |
(lexical-let | |
((pos (point)) | |
(count 20) | |
img) | |
(insert " ") | |
(cc:thread | |
100 | |
(while (< 0 count) | |
(progn | |
(decf count 1) | |
(setq img (create-image (make-svg count) 'svg t)) | |
(put-text-property pos (1+ pos) 'display img))) | |
(save-excursion | |
(goto-char pos) | |
(delete-char 1)) | |
(message "Finish."))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment