diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Light.elm | 49 | ||||
-rw-r--r-- | examples/elm-package.json | 15 |
2 files changed, 64 insertions, 0 deletions
diff --git a/examples/Light.elm b/examples/Light.elm new file mode 100644 index 0000000..a83308a --- /dev/null +++ b/examples/Light.elm @@ -0,0 +1,49 @@ +module Light exposing (main) + +import Html exposing (text, pre) +import Json.Encode +import Mapbox.Expression exposing (..) +import Mapbox.Layer as Layer +import Mapbox.Source as Source +import Mapbox.Style as Style + + +style = + Style.encode + { transition = Style.defaultTransition + , light = Style.defaultLight + , sources = + [ Source.vectorFromUrl "composite" "mapbox://mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v7" ] + , misc = + [ Style.name "light" + , Style.defaultCenter 20.39789404164037 43.22523201923144 + , Style.defaultZoomLevel 1.5967483759772743 + , Style.sprite "mapbox://sprites/seppotamminen/cjascxlb86kfe2rrvvtkd4ay1" + , Style.glyphs "mapbox://fonts/seppotamminen/{fontstack}/{range}.pbf" + ] + , layers = + [ Layer.background "background" + [ getProperty (str "emotion") + |> matchesStr (rgba 55 22 32 1) [ ( "funny", rgba 20 200 20 1 ), ( "angry", rgba 200 20 20 1 ) ] + |> Layer.backgroundColor + , zoom + |> interpolate Linear + [ ( 5, int 1 ) + , ( 10, int 5 ) + ] + |> Layer.circleRadius + , makeRGBColor + -- red is higher when feature.properties.temperature is higher + (getProperty (str "temperature")) + -- green is always zero + (int 0) + -- blue is higher when feature.properties.temperature is lower + (getProperty (str "temperature") |> minus (int 100)) + |> Layer.circleColor + ] + ] + } + + +main = + pre [] [ text <| Json.Encode.encode 2 style ] diff --git a/examples/elm-package.json b/examples/elm-package.json new file mode 100644 index 0000000..00c0096 --- /dev/null +++ b/examples/elm-package.json @@ -0,0 +1,15 @@ +{ + "version": "1.0.0", + "summary": "helpful summary of your project, less than 80 characters", + "repository": "https://github.com/user/project.git", + "license": "BSD3", + "source-directories": [ + "../src", "." + ], + "exposed-modules": [], + "dependencies": { + "elm-lang/core": "5.1.1 <= v < 6.0.0", + "elm-lang/html": "2.0.0 <= v < 3.0.0" + }, + "elm-version": "0.18.0 <= v < 0.19.0" +} |