Created
May 5, 2012 08:29
-
-
Save vaiorabbit/2600931 to your computer and use it in GitHub Desktop.
Generates pattern animation table from
This file contains 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
; Generates pattern animation table from | |
; * image width/height | |
; * cell row/column/width/height. | |
(let (cw ch iw ih cc cr y) | |
(setq cw 240) (setq ch 296) (setq iw 1440) (setq ih 1480) (setq cc 6) (setq cr 5) | |
(setq y 0) | |
(while (< y cr) | |
(let (x) | |
(setq x 0) | |
(while (< x cc) | |
(insert (format "\tnew PatternAnimRect(%d, %d, %d, %d), // %d\n" (* x cw) (* y ch) cw ch (+ x (* y cc)))) ; x, y, w, h, id | |
(setq x (+ x 1)))) | |
(setq y (+ y 1)))) | |
; Output: | |
; new PatternAnimRect(0, 0, 240, 296), // 0 | |
; new PatternAnimRect(240, 0, 240, 296), // 1 | |
; new PatternAnimRect(480, 0, 240, 296), // 2 | |
; new PatternAnimRect(720, 0, 240, 296), // 3 | |
; ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment