Skip to content

Commit

Permalink
tweaked rotozoom startup
Browse files Browse the repository at this point in the history
  • Loading branch information
ktuukkan committed Apr 2, 2016
1 parent aee4ae5 commit 4918ef3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 26 deletions.
34 changes: 18 additions & 16 deletions Rotozoom.elm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Rotozoom(cornfield, rotozoom, main) where
module Rotozoom(rotozoom, main) where

import Color exposing (..)
import Graphics.Collage exposing (..)
Expand All @@ -11,19 +11,21 @@ import Window
main =
Signal.map3 rotozoom Window.width Window.height (Signal.foldp (+) 0 (fps 30))

cornfield w h t =
collage w h
[ tiledImage (w * 5) (h * 5) "chilicorn.png"
|> toForm
|> scale(0.425)
|> alpha ((t/4000))
]

rotozoom w h t =
collage w h
[ tiledImage (w * 5) (h * 5) "chilicorn.png"
|> toForm
|> scale(1.33 + cos(t/1000))
|> rotate (degrees ((sin(t/1000) * 100) + (cos(t/2000)) * 150))
|> move ((sin(t/1000) * 150), (sin(t/1000) * 150))
]
if t < 10000 then
collage w h
[ tiledImage (w * 5) (h * 5) "chilicorn.png"
|> toForm
|> scale (1.33 + cos(10000/1000))
|> alpha (t/5000)
|> rotate (degrees ((sin(10000/1000) * 100) + (cos(10000/2000)) * 150))
|> move ((sin(t/1000) * 150), (sin(10000/1000) * 150))
]
else
collage w h
[ tiledImage (w * 5) (h * 5) "chilicorn.png"
|> toForm
|> scale(1.33 + cos(t/1000))
|> rotate (degrees ((sin(t/1000) * 100) + (cos(t/2000)) * 150))
|> move ((sin(t/1000) * 150), (sin(t/1000) * 150))
]
21 changes: 11 additions & 10 deletions demo1.elm
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ updateState time state =

selectEffect : Float -> Effect
selectEffect t =
if t < 10 then
Cornfield
else if t < 20 then
if t < 15 then
Starfield
else if t < 40 then
else if t < 45 then
Rotozoom
else if t < 60 then
Hypnocorn
Expand All @@ -75,24 +73,27 @@ main =

view : State -> (Int, Int) -> Element
view state (w, h) =
let
time = (state.time - state.effectStart)
in
case state.effect of
Cornfield ->
flow outward [cornfield w h state.time, muzak]
empty --flow outward [cornfield w h time, muzak]
Hypnocorn ->
flow outward [hypnocorn w h state.time, muzak]
flow outward [hypnocorn w h time, muzak]
Starfield ->
flow outward [Starfield.view state.stars (w, h), muzak]
Chilicorn ->
flow outward [chilicorn w h state.time, muzak]
flow outward [chilicorn w h time, muzak]
Rotozoom ->
flow outward [rotozoom w h state.time, muzak]
flow outward [rotozoom w h time, muzak]
Plasma ->
flow outward [plasma w h state.time, muzak]
flow outward [plasma w h time, muzak]

chilicorn w h t =
collage w h
[ image h h "chilicorn.png"
|> toForm
|> scale (0.33)
|> alpha (1.05 - sin(t/1000))
|> alpha (0 + sin(t/1000))
]

0 comments on commit 4918ef3

Please sign in to comment.