Skip to content

Instantly share code, notes, and snippets.

@sordina
Created July 20, 2011 13:22
Show Gist options
  • Save sordina/1094936 to your computer and use it in GitHub Desktop.
Save sordina/1094936 to your computer and use it in GitHub Desktop.
Circle Animation
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