import Graphics.Element exposing (..)
import Graphics.Collage exposing (..)
import Color
import Signal
import Window
circle : (Int, Int) -> Element
circle (w, h) =
let
padding = 5
rad = toFloat (min w h) - padding
in
collage w h
[
oval rad rad
|> filled Color.red
]
main : Signal Element
main =
Signal.map circle Window.dimensions
import Graphics.Element exposing (..)
import Signal
import Mouse
import Graphics.Collage exposing (..)
import Color
-- States and transitions
type GameState = Intro | Play | GameOver | UnknownState
next : GameState -> GameState
next state =
case state of
Intro -> Play
Play -> GameOver
GameOver -> Intro
_ -> UnknownState
-- Rendering
render : GameState -> Element
render state =
case state of
Intro -> collage 100 100 [ rect 100 100 |> filled Color.lightBlue ]
Play -> collage 100 100 [ rect 100 100 |> filled Color.green ]
GameOver -> collage 100 100 [ rect 100 100 |> filled Color.red ]
_ -> show "Unknown state"
-- main
main : Signal Element
main =
Signal.map render (Signal.foldp (\click state -> next state) Intro Mouse.clicks)
I wish for a cookbook/wiki, filled with user-contributed snippets of Elm code that address specific needs, also allowing users to add to a wish list and/or contribute their own.
I wish for a cookbook/wiki, filled with user-contributed snippets of Elm code that address specific needs, also allowing users to add to a wish list and/or contribute their own.Strongly agree! We had something like this (https://github.com/robotlegs/robotlegs-demos-Bundle) on a MVC I worked on which was superb. Basically each folder contains someone's sample app. I think good criteria would be anything 1) that runs, 2) not duplicate, 3) not offensive, and 4) <1 MB (because many projects would be aggregated in one place). An alternative would be an "awesome list" (https://github.com/sindresorhus/awesome) of such projects. That's what Brunch does (http://brunch.io/skeletons.html). Preference? Alternative?
--
You received this message because you are subscribed to a topic in the Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elm-discuss/hdKyIsAjnR4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I think this could live in the same repo as the roadmap from the other thread. I think we should try self-moderation and make a new plan if that doesn't work. It would be understood that the examples are communal, and anyone with access can improve them.
--
I think this could live in the same repo as the roadmap from the other thread.
anyone with access can improve them.
Would you care to make a first (sample) contrib? I'd follow suit after that. :)
It would be understood that the examples are communal, and anyone with access can improve them.
1. bug fixes2. greater clarity3. performance improvements
Can we also add what version of ELM they are made to run against?
Each project will be required to be runnable including the package file listing all versions.
same folder. (Right?)
simple demos that rely only on core
I started working on the Sublime plugin first because of lack of feedback. I think it's an afternoon project including a Bash script to make it easy to accept and update contributions by other maintainers. I should have time this weekend though.