API Docs for: 0.1.1
Show:

Sprite Class

Module: Joy

Constructor

Sprite

(
  • data
  • width
  • height
)

Parameters:

  • data String | Object

    src (String) or

  • width Number
  • height Number

Methods

addChild

(
  • UNKNOWN
)
DisplayObjectContainer

Inherited from DisplayObjectContainer:

Add a display object in the list.

Parameters:

Returns:

allowCollisionFrom

(
  • target
)
DisplayObject

Inherited from DisplayObject:

Parameters:

Returns:

behave

(
  • UNKNOWN
)
Triggerable

Inherited from Triggerable:

Behave like a {Behaviour}

Parameters:

  • UNKNOWN Behaviour

Returns:

Triggerable: this

bind

(
  • type
  • handler
)
Triggerable

Inherited from Triggerable:

Bind event handler

Parameters:

  • type String

    event type

  • handler Function

Returns:

Triggerable: this

blend

(
  • compositeOperation
)
DisplayObject

Inherited from DisplayObject:

Apply composite operation on DisplayObject's canvas.

Parameters:

  • compositeOperation String

Returns:

broadcast

(
  • UNKNOWN
)
DisplayObjectContainer

Inherited from DisplayObjectContainer:

Parameters:

  • UNKNOWN String

Returns:

checkCollisions

()

Inherited from DisplayObject:

Called on UPDATE, triggers COLLISIONENTER, COLLISIONEXIT and COLLISION events.

fillRect

(
  • x
  • y
  • width
  • height
)
DisplayObject

Inherited from DisplayObject:

Parameters:

  • x Number
  • y Number
  • width Number
  • height Number

Returns:

fillStyle

(
  • color
)
DisplayObject

Inherited from DisplayObject:

Parameters:

  • color Color, String

Returns:

getChildAt

(
  • index
)
DisplayObject

Inherited from DisplayObjectContainer:

Parameters:

  • index Number

Returns:

getChildById

(
  • id
)
DisplayObject

Inherited from DisplayObjectContainer:

Search for a child by id attribute

Parameters:

  • id String

Returns:

getMatrix

() Matrix2D

Inherited from DisplayObject:

Get a clone of the current transformation

Returns:

hasBehaviour

(
  • target
)
Boolean

Inherited from Triggerable:

This object behaves as {target} behaviour?

Parameters:

  • target Behaviour

Returns:

Boolean:

load

(
  • src
)

Parameters:

  • src String

    image source

render

()

Inherited from DisplayObject:

Apply all custom context operations.

rotate

(
  • angle
)

Inherited from DisplayObject:

Parameters:

  • angle Number

setScale

(
  • x
  • y
)

Inherited from DisplayObject:

Parameters:

  • x Number
  • y Number

shadow

(
  • [options]
)
DisplayObject

Inherited from DisplayObject:

Register shadow context operations

Parameters:

  • [options] Object optional

    shadow options

    • [color] Color, String optional

      shadow color

    • [offsetX] Number optional

      shadow x offset

    • [offsetY] Number optional

      shadow y offset

    • [blur] Number optional

      shadow blur ratio

Returns:

swapChildren

(
  • child1
  • child2
)

Inherited from DisplayObjectContainer:

Swap index of two children

Parameters:

transform

(
  • m11
  • m12
  • m21
  • m22
  • dx
  • dy
)

Inherited from DisplayObject:

Parameters:

  • m11 Number

    The m1,1 value in the matrix.

  • m12 Number

    The m1,2 value in the matrix.

  • m21 Number

    The m2,1 value in the matrix.

  • m22 Number

    The m2,2 value in the matrix.

  • dx Number

    The delta x (dx) value in the matrix.

  • dy Number

    The delta y (dy) value in the matrix.

translate

(
  • x
  • y
)

Inherited from DisplayObject:

Parameters:

  • x Number
  • y Number

trigger

(
  • type
  • arguments
  • delay
)

Inherited from Triggerable:

Triggers event type

Parameters:

  • type String

    event type

  • arguments Array

    arguments for callback

  • delay Number

unbind

(
  • type
)
Triggerable

Inherited from Triggerable:

Remove event handlers

Parameters:

  • type String

    event type

Returns:

Triggerable: this

updateContext

() DisplayObject

Inherited from DisplayObject:

Update canvas context, based on DisplayObject transformation variables

Returns:

willCollideAt

(
  • projection
)
DisplayObject, null

Inherited from DisplayObject:

Parameters:

Returns:

DisplayObject, null:

Attributes

alpha

Number

Inherited from DisplayObject:

Default: 1

bottom

Number readonly

Inherited from DisplayObject:

children

Array

Inherited from DisplayObjectContainer:

collider

DisplayObject | RectCollider

Inherited from DisplayObject:

Collider object. Can be a DisplayObject, or a geometry collider.

Default: this

ctx

Canvas2D readonly

Inherited from DisplayObject:

Context that this DisplayObject will be rendered in

flipX

Boolean

Inherited from DisplayObject:

Default: false

flipY

Boolean

Inherited from DisplayObject:

Default: false

height

Number

Inherited from DisplayObject

Default: 0

id

String

Inherited from DisplayObject:

Default: "joy..."

index

Number readonly

Inherited from DisplayObject:

Index of this DisplayObject on the DisplayObjectContainer

matrix

Matrix2D

Inherited from DisplayObject:

Reference of the current transformation matrix.

numChildren

Number readonly

Inherited from DisplayObjectContainer:

Number of children displayObject's attached to the container.

parent

DisplayObjectContainer readonly

Inherited from DisplayObject:

Parent DisplayObject

pivot

Vector2d

Inherited from DisplayObject:

Default: 0,0

position

Vector2d

Inherited from DisplayObject:

Default: 0,0

right

Number readonly

Inherited from DisplayObject:

rotation

Number

Inherited from DisplayObject:

Default: 0

scale

Vector2d

Inherited from DisplayObject:

Default: 1,1

skewX

Number

Inherited from DisplayObject:

Default: 0

smooth

Boolean

Inherited from DisplayObject:

Default: false

visible

Boolean

Inherited from DisplayObject:

Is this DisplayObject able for rendering?

width

Number

Inherited from DisplayObject

Default: 0