Created
July 20, 2011 13:22
-
-
Save sordina/1094936 to your computer and use it in GitHub Desktop.
Circle Animation
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
import Diagrams.AST | |
import Control.Monad | |
main = forM_ [0..359] render | |
render i = outputImage ("image_" ++ show i ++ ".png") 100 100 $ animate (fromIntegral i) | |
animate t = Images $ Layers [ | |
Modifier (Align C) $ Images $ Layers [ | |
Modifier (Rotate $ Degrees t) shape | |
, Modifier (Changes [Foreground black, Scale 14 14]) circle | |
] | |
, Modifier (Changes [LineWidth 0, Scale 40 40, Foreground white]) (Shape Square) | |
] | |
shape = Modifier (Translate 10 10) $ | |
Images $ Layers [ | |
Modifier(Changes [LineWidth 1, Scale 3 3, Foreground white]) circle | |
, scale 5 clearCircle | |
] | |
white = RGBA 1 1 1 1 | |
black = RGBA 0 0 0 1 | |
circle = Shape Circle | |
clearCircle = Modifier (LineWidth 0) circle | |
scale x = Modifier $ Scale x x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment