This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
1.0.0
Gradual introduction to interactive graphics programs.
version 2.0.0
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 2.0.0
Committed At 2017-06-18 23:40:04 UTC
evancz/elm-graphics 1.0.1 <= v < 2.0.0 1.0.1
elm-lang/window 1.0.1 <= v < 2.0.0 1.0.1
elm-lang/mouse 1.0.1 <= v < 2.0.0 1.0.1
elm-lang/keyboard 1.0.1 <= v < 2.0.0 1.0.1
elm-lang/html 2.0.0 <= v < 3.0.0 2.0.0
elm-lang/core 5.0.0 <= v < 6.0.0 5.1.1
elm-lang/animation-frame 1.0.1 <= v < 2.0.0 1.0.1

README

elm-interactive-graphics

Gradual introduction to interactive graphics programs.

The Steps:

  1. Drawing: draw elements
  2. Animation: draw with time
  3. Simulation: draw with time and model
  4. Interaction: draw with time and msgs

Sample Simulation Program

import Color exposing (..)
import Collage exposing (Form)
import Collage.Interaction exposing (simulationProgram, SimulationProgram)


type alias Model =
    ( Float, Float, Float, Float, Float )


init : Model
init =
    ( 0, 0, 2, 1, 30 )


view : Model -> Form
view ( x, y, dx, dy, radius ) =
    move ( x, y ) (filled red (circle radius))


update : Float -> Model -> Model
update time ( x, y, dx, dy, radius ) =
    if x + radius > 200 || x - radius < -200 then
        ( x - dx, y + dy, -dx, dy, radius )
    else if y + radius > 200 || y - radius < -200 then
        ( x + dx, y - dy, dx, -dy, radius )
    else
        ( x + dx, y + dy, dx, dy, radius )


main : Simulation Model
main =
    simulationProgram
        { init = init
        , view = view
        , update = update
        }

Influences: