by Ossi Hanhinen, @ohanhi
with the support of Futurice 💚.
Licensed under CC BY 4.0.
module Main exposing (..) | |
import Html exposing (..) | |
import Html.App as App | |
import Html.Attributes exposing (..) | |
import Html.Events exposing (..) | |
main = | |
App.beginnerProgram |
module Main where | |
import Html exposing (Html, text, p) | |
import Signal exposing (Address) | |
import Effects exposing (Effects, Never) | |
import Json.Decode as Json exposing ((:=)) | |
import StartApp exposing (start) | |
import Task | |
import Http |
/* global window */ | |
function StageResizer (stageElement, options) { | |
options = options || {}; | |
this._element = stageElement; | |
this._stageWidth = options.stageWidth || stageElement.offsetWidth || 1; | |
this._stageHeight = options.stageWidth || stageElement.offsetWidth || 1; | |
this._snapToEdge = options.snapToEdge || true; |
------------------------------------------------ | |
-- 2D Point Type | |
type Point = { | |
x : Float, | |
y : Float | |
} | |
-- Convert Point to a tuple of floats | |
toTuple : Point -> (Float, Float) | |
toTuple point = (point.x, point.y) |
// Excerpt from: https://github.com/Animatron/player/blob/master/anm.collisions.js | |
function edgeTest(p1, p2, p3, r2) { | |
var rot = [ -(p2[1] - p1[1]), | |
p2[0] - p1[0] ]; | |
var ref = (rot[0] * (p3[0] - p1[0]) + | |
rot[1] * (p3[1] - p1[1])) >= 0; | |
for (var i = 0, il = r2.length; i < il; i+=2) { |