SpriteMaterial

SpriteMaterial

new SpriteMaterial(img, framesopt, actionsopt)

Source:
Implements:
Parameters:
Name Type Attributes Default Description
img HTMLImageElement Image to draw
frames number <optional>
1 Number of cutouts in the sprite in the X axis of the image.
actions number <optional>
1 Number of cutouts in the sprite in the Y axis of the image.

Classes

SpriteMaterial

Members

frameRate :number

Description:
  • The maximum frames for each given action.
Source:
The maximum frames for each given action.
Type:
  • number

height :number

Description:
  • The height of the sprite..
Source:
The height of the sprite..
Type:
  • number

img :HTMLImageElement

Source:
Type:
  • HTMLImageElement

width :number

Description:
  • The width of the sprite.
Source:
The width of the sprite.
Type:
  • number

Methods

setAction(index)

Description:
  • Sets a given action to be rendered
Source:
Parameters:
Name Type Description
index number

setMaxFrames(action, max)

Description:
  • Sets max number of frames for a given action
Source:
Parameters:
Name Type Description
action number
max number

setup(frames, actions)

Source:
Parameters:
Name Type Description
frames number
actions number