-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hypnocorn.elm
69 lines (65 loc) · 1.93 KB
/
Hypnocorn.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
module Hypnocorn(hypnocorn, main) where
import Color exposing (..)
import Graphics.Collage exposing (..)
import Graphics.Element exposing (..)
import Time exposing (..)
import Random exposing (..)
import Basics exposing (..)
import Window
main =
Signal.map3 hypnocorn Window.width Window.height (Signal.foldp (+) 0 (fps 30))
hypnocorn w h t =
collage w h
[ ngon 5 (toFloat w/13)
|> filled colorize
|> rotate (degrees ((t/1000) * -5))
|> alpha(t/500)
, ngon 6 (toFloat w/11)
|> filled colorize
|> rotate (degrees ((t/1000) * -25))
|> alpha(t/1000)
, ngon 7 (toFloat w/9)
|> filled colorize
|> rotate (degrees ((t/1000) * -45))
|> alpha(t/1500)
, ngon 8 (toFloat w/8)
|> filled colorize
|> rotate (degrees ((t/1000) * -65))
|> alpha(t/2000)
, ngon 9 (toFloat w/7)
|> filled colorize
|> rotate (degrees ((t/1000) * -85))
|> alpha(t/2500)
, ngon 10 (toFloat w/6)
|> filled colorize
|> rotate (degrees ((t/1000) * -105))
|> alpha(t/3000)
, ngon 8 (toFloat w/5)
|> filled colorize
|> rotate (degrees ((t/1000) * -125))
|> alpha(t/3500)
, ngon 8 (toFloat w/4)
|> filled colorize
|> rotate (degrees ((t/1000) * -145))
|> alpha(t/4000)
, ngon 9 (toFloat w/3)
|> filled colorize
|> rotate (degrees ((t/1000) * -165))
|> alpha(t/4500)
, ngon 10 (toFloat w/2)
|> filled colorize
|> rotate (degrees ((t/1000) * -185))
|> alpha(t/5000)
, ngon 4 (toFloat w)
|> filled colorize
|> alpha(t/5500)
, image 50 50 "chilicorn.png"
|> toForm
|> rotate (degrees (-15 * cos(t/1000)))
|> scale (5 + (sin(t/1000) * cos(t/1000) * 4))
|> move (cos(t/1000) * 40, cos(t/1000) * 75)
|> alpha(t/2000)
]
colorize : Color
colorize =
rgba 0 64 0 0.30