Crafty.init

Events

EnterFrame [Data: { frame: Number }]
on each frame
Load
Just after the viewport is initialised. Before the EnterFrame loops is started

public this Crafty.init([Number width, Number height])

width
Width of the stage
height
Height of the stage

Create a div with id cr-stage, if there is not already an HTMLElement with id cr-stage (by Crafty.viewport.init).

Starts the EnterFrame interval. This will call the EnterFrame event for every frame.

Can pass width and height values for the stage otherwise will default to window size (see Crafty.DOM.window).

All Load events will be executed.

Uses requestAnimationFrame to sync the drawing with the browser but will default to setInterval if the browser does not support it.

See Also