shine-0.2.0.2: Declarative graphics for the browser using GHCJS

Copyright(c) Francesco Gazzetta 2016
LicenseMIT
Maintainerfrancygazz@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell98

Graphics.Shine

Contents

Description

The main module. Here are defined all the functions needed to get an animation on the screen.

If you want to render a single Picture only once, use render from Render

Synopsis

Getting a rendering context

toContext Source #

Arguments

:: Element

this must be a canvas

-> JSM CanvasRenderingContext2D 

Get a context from a canvas element.

fixedSizeCanvas :: Document -> Int -> Int -> JSM CanvasRenderingContext2D Source #

Create a fixed size canvas given the dimensions

Drawing

animate Source #

Arguments

:: CanvasRenderingContext2D

the context to draw on

-> Double

FPS

-> (Double -> Picture)

Your drawing function

-> JSM () 

Draws a picture which depends only on the time

animateIO Source #

Arguments

:: CanvasRenderingContext2D

the context to draw on

-> Double

FPS

-> (Double -> IO Picture)

Your drawing function

-> JSM () 

Draws a picture which depends only on the time... and everything else, since you can do I/O.

play Source #

Arguments

:: (IsEventTarget eventElement, IsDocument eventElement) 
=> CanvasRenderingContext2D

the context to draw on

-> eventElement 
-> Double

FPS

-> state

Initial state

-> (state -> Picture)

Drawing function

-> (Input -> state -> state)

Input handling function

-> (Double -> state -> state)

Stepping function

-> JSM () 

Lets you manage the input.

playIO Source #

Arguments

:: (IsEventTarget eventElement, IsDocument eventElement) 
=> CanvasRenderingContext2D

the context to draw on

-> eventElement 
-> Double

FPS

-> state

Initial state

-> (state -> IO Picture)

Drawing function

-> (Input -> state -> IO state)

Input handling function

-> (Double -> state -> IO state)

Stepping function

-> JSM () 

Same thing with I/O