Skip to content

Commit

Permalink
Some random effect
Browse files Browse the repository at this point in the history
  • Loading branch information
Miko Mynttinen committed Apr 2, 2016
1 parent fa1d4f4 commit 0868a20
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 11 additions & 3 deletions demo1.elm
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ import Plasma exposing (..)
import Hypnocorn exposing (..)
import Rotozoom exposing (..)
import Starfield
import SquareThing
import Html exposing (..)
import Html.Attributes exposing (..)


type Effect = Rotozoom | Hypnocorn | Plasma | Starfield | Chilicorn
type Effect = Rotozoom | Hypnocorn | Plasma | Starfield | Chilicorn | SquareThing

type alias State =
{ effect : Effect
, effectStart : Float
, time : Float
, stars: Starfield.Stars
, stars : Starfield.Stars
, squares : SquareThing.Squares
}

muzak : Element
Expand All @@ -33,6 +35,7 @@ initialState =
, effectStart = 0
, time = 0
, stars = Starfield.stars
, squares = SquareThing.initialSquares
}

updateState : Float -> State -> State
Expand All @@ -49,7 +52,8 @@ updateState time state =
effect = effect,
effectStart = effectStart,
time = time,
stars = Starfield.update state.time state.stars
stars = Starfield.update state.time state.stars,
squares = SquareThing.update state.time state.squares
}

selectEffect : Float -> Effect
Expand All @@ -62,6 +66,8 @@ selectEffect t =
Hypnocorn
else if t < 80 then
Plasma
else if t < 100 then
SquareThing
else
Chilicorn

Expand All @@ -86,6 +92,8 @@ view state (w, h) =
rotozoom w h time
Plasma ->
plasma w h time
SquareThing ->
SquareThing.view state.squares (w, h)
in
flow outward [effectView, muzak]

Expand Down
1 change: 1 addition & 0 deletions elm-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
],
"exposed-modules": [],
"dependencies": {
"circuithub/elm-list-extra": "3.10.0 <= v < 4.0.0",
"elm-community/elm-linear-algebra": "2.0.0 <= v < 3.0.0",
"elm-community/elm-webgl": "1.0.0 <= v < 2.0.0",
"elm-lang/core": "3.0.0 <= v < 4.0.0",
Expand Down

0 comments on commit 0868a20

Please sign in to comment.