Controls

TriggerInputDown [Data = {name}]
When a trigger group is activated
TriggerInputUp [Data = {name, downFor}]
When a trigger group is released
DirectionalInput [Data = {name, x, y}]
When a directional input changes

Jumper

CheckJumping
When entity is about to jump. This event is triggered with the object the entity is about to jump from (if it exists). Third parties can respond to this event and enable the entity to jump.

Crafty.selected

CraftyFocus
is triggered when Crafty's stage gets selected
CraftyBlur
is triggered when Crafty's stage is no longer selected

Crafty.mouseWheelDispatch

MouseWheelScroll [Scroll direction (up | down) = { direction: +1 | -1}]
is triggered when mouse is scrolled on stage

Crafty.keyboardDispatch

KeyDown [Crafty's KeyboardEvent = { key: `Crafty.keys` keyCode (Number), originalEvent: original KeyboardEvent }]
is triggered for each entity when the DOM 'keydown' event is triggered.
KeyUp [Crafty's KeyboardEvent = { key: `Crafty.keys` keyCode (Number), originalEvent: original KeyboardEvent }]
is triggered for each entity when the DOM 'keyup' event is triggered.

Mouse

MouseOver [Data = {MouseEvent}]
when the mouse enters
MouseOut [Data = {MouseEvent}]
when the mouse leaves
MouseDown [Data = {MouseEvent}]
when the mouse button is pressed on
MouseUp [Data = {MouseEvent}]
when the mouse button is released on
Click [Data = {MouseEvent}]
when the user clicks
DoubleClick [Data = {MouseEvent}]
when the user double clicks
MouseMove [Data = {MouseEvent}]
when the mouse is over and moves

Touch

TouchStart [Data = {TouchPoint}]
when entity is touched
TouchMove [Data = {TouchPoint}]
when finger is moved over entity
TouchCancel [Data = {TouchPoint}]
when a touch event has been disrupted in some way
TouchEnd [Data = {null}]
when the finger is raised over the entity, or when finger leaves entity. (Passes no data)

.areaMap

NewAreaMap [Data = {Crafty.polygon}]
when a new areaMap is assigned

MouseDrag

Dragging [Data = {MouseEvent}]
is triggered each frame the entity is being dragged
StartDrag [Data = {MouseEvent}]
is triggered when dragging begins
StopDrag [Data = {MouseEvent}]
is triggered when dragging ends

Keyboard

KeyDown [Crafty's KeyboardEvent = { key: `Crafty.keys` keyCode (Number), originalEvent: original KeyboardEvent }]
is triggered for each entity when the DOM 'keydown' event is triggered.
KeyUp [Crafty's KeyboardEvent = { key: `Crafty.keys` keyCode (Number), originalEvent: original KeyboardEvent }]
is triggered for each entity when the DOM 'keyup' event is triggered.

Crafty Core

NewEntityName [entity name = {String}]
After setting new name for entity
NewComponent [Component = {String}]
when a new component is added to the entity
RemoveComponent [Component = {String}]
when a component is removed from the entity
Remove
when the entity is removed by calling .destroy()

.attr

Change [Data = {key: value}]
when properties change

Crafty.init

Load
Just after the viewport is initialised. Before the EnterFrame loops is started

Crafty.stop

CraftyStop [Data = {bool clearState}]
when the game is stopped

Crafty.pause

Pause
when the game is paused
Unpause
when the game is unpaused

Crafty.timer.steptype

NewSteptype [New steptype = { mode, maxTimeStep }]
when the current steptype changes

Crafty.timer.step

EnterFrame [Data = { frame: Number, dt:Number }]
Triggered on each frame. Passes the frame number, and the amount of time since the last frame. If the time is greater than maxTimestep, that will be used instead. (The default value of maxTimestep is 50 ms.)
ExitFrame [Data = { frame: Number, dt:Number }]
Triggered after each frame. Passes the frame number, and the amount of time since the last frame. If the time is greater than maxTimestep, that will be used instead. (The default value of maxTimestep is 50 ms.)
PreRender
Triggered every time immediately before a scene should be rendered
RenderScene
Triggered every time a scene should be rendered
PostRender
Triggered every time immediately after a scene should be rendered
MeasureWaitTime [Data = {Number}]
Triggered at the beginning of each step after the first. Passes the time the game loop waited between steps.
MeasureFrameTime [Data = {Number}]
Triggered after each frame. Passes the time it took to advance one frame.
MeasureRenderTime [Data = {Number}]
Triggered after each render. Passes the time it took to render the scene

Crafty.timer.FPS

FPSChange [new target FPS = {Number}]
Triggered when the target FPS is changed by user

Crafty.e

NewEntity [Data = { id:Number }]
When the entity is created and all components are added

Crafty.asset

NewAsset [key and value of new added asset. = {Object}]
After setting new asset

Model

Change
When any data on the model has changed.
Change[key]
When the specific key on the model has changed.
Change[key.key]
The nested key value has changed.

Crafty.scene

SceneChange [Data = { oldScene:String, newScene:String }]
just before a new scene is initialized
SceneDestroy [Data = { newScene:String }]
just before the current scene is destroyed

Crafty.s

SystemLoaded [system object = {obj}]
When the system has initialized itself
SystemDestroyed [system object = {obj}]
Right before the system is destroyed

Tween

TweenEnd [property = {String}]
when a tween finishes

DebugCanvas

DebugDraw
when the entity is ready to be drawn to the stage
NoCanvas
if the browser does not support canvas

Canvas

Draw [Data = {type: "canvas", pos, co, ctx}]
when the entity is ready to be drawn to the stage
NoCanvas
if the browser does not support canvas

.color

Invalidate
when the color changes

.DOM

Draw [Data = { style:String, type:"DOM", co}]
when the entity is ready to be drawn to the stage

.image

Invalidate
when the image is loaded

Particles

ParticleEnd
when the particle animation has finished

Renderable

Invalidate
when the entity needs to be redrawn

.flip

Invalidate
when the entity has flipped

.unflip

Invalidate
when the entity has unflipped

SpriteAnimation

StartAnimation [Data = {Reel}]
When an animation starts playing, or is resumed from the paused state
AnimationEnd [Data = { Reel }]
When the animation finishes
FrameChange [Data = { Reel }]
Each time the frame of the current reel changes
ReelChange [Data = { Reel }]
When the reel changes

Sprite

Invalidate
when the sprites change

Text

Invalidate
when the text is changed

.textFont

Invalidate

.unselectable

Invalidate

Crafty.viewport

ViewportScroll
when the viewport's x or y coordinates change
ViewportScale
when the viewport's scale changes
ViewportResize
when the viewport's dimension's change
InvalidateViewport
when the viewport changes
StopCamera
when any camera animations should stop, such as at the start of a new animation.
CameraAnimationDone
when a camera animation reaches completion

Crafty.viewport.reset

StopCamera
called to cancel camera animations

WebGL

Draw [Data = {type: "canvas", pos, co, ctx}]
when the entity is ready to be drawn to the stage
NoCanvas
if the browser does not support canvas

2D

Move [Old position = { _x:Number, _y:Number, _w:Number, _h:Number }]
when the entity has moved
Invalidate
when the entity needs to be redrawn
Rotate [Data = { cos:Number, sin:Number, deg:Number, rad:Number, o: {x:Number, y:Number}}]
when the entity is rotated
Reorder
when the entity's z index has changed

.offsetBoundary

BoundaryOffset
when the MBR offset changes

Collision

HitOn [Data = { hitData }]
Triggered when collisions occur. Will not trigger again until collisions of this type cease, or an event is requested once more (using `resetHitChecks(component)`).
HitOff [componentName = {String}]
Triggered when collision with a specific component type ceases

.collision

NewHitbox [Data = {Crafty.polygon}]
when a new hitbox is assigned

AngularMotion

Rotated [Old rotation = {Number}]
When entity has rotated due to angular velocity/acceleration a Rotated event is triggered.
NewRotationDirection [New direction = {-1 | 0 | 1}]
When entity has changed rotational direction due to rotational velocity a NewRotationDirection event is triggered. The event is triggered once, if direction is different from last frame.
MotionChange [Motion property name and old value = { key: String, oldValue: Number }]
When a motion property has changed a MotionChange event is triggered.

Motion

Moved [Old position = { axis: 'x' | 'y', oldValue: Number }]
When entity has moved due to velocity/acceleration on either x or y axis a Moved event is triggered. If the entity has moved on both axes for diagonal movement the event is triggered twice.
NewDirection [New direction = { x: -1 | 0 | 1, y: -1 | 0 | 1 }]
When entity has changed direction due to velocity on either x or y axis a NewDirection event is triggered. The event is triggered once, if direction is different from last frame.
MotionChange [Motion property name and old value = { key: String, oldValue: Number }]
When a motion property has changed a MotionChange event is triggered.

Supportable

LandedOnGround
When entity has landed. This event is triggered with the object the entity landed on.
LiftedOffGround
When entity has lifted off. This event is triggered with the object the entity stood on before lift-off.
CheckLanding
When entity is about to land. This event is triggered with the object the entity is about to land on. Third parties can respond to this event and prevent the entity from being able to land.