Text Class
A Text Object will create a line(s) of text to split a line you can use "\n" see PIXI.Text for more information.
Constructor
Text
-
text
-
[style]
Parameters:
-
text
StringThe copy that you would like the text to display
-
[style]
Object optionalThe style parameters
-
[font]
String optionaldefault "bold 20pt Arial" The style and size of the font
-
[fill="black"]
Object optionalA canvas fillstyle that will be used on the text eg "red", "#00FF00"
-
[align="left"]
String optionalAn alignment of the multiline text ("left", "center" or "right")
-
[stroke]
String optionalA canvas fillstyle that will be used on the text stroke eg "blue", "#FCFF00"
-
[strokeThickness=0]
Number optionalA number that represents the thickness of the stroke. Default is 0 (no stroke)
-
[wordWrap=false]
Boolean optionalIndicates if word wrap should be used
-
[wordWrapWidth=100]
Number optionalThe width at which text will wrap
-
Item Index
Properties
Methods
addAnimation
-
name
-
frames
-
[speed]
-
[loop]
Adds a new animation to this animated sprite
Parameters:
-
name
StringThe string name of the animation
-
frames
ArrayThe array of texture frames
-
[speed]
Number optionalThe animation speed
-
[loop]
Boolean optionalLoop the animation or not
Returns:
Returns itself.
clone
()
Sprite
Creates a new Sprite instance with the same values as this one
Returns:
Returns the new sprite
destroy
()
Removes this sprite from the stage and the physics system
emit
-
type
-
data
Emits an event which will run all registered listeners for the event type
Parameters:
-
type
StringThe event name to emit
-
data
MixedAny data you want passed along with the event
Returns:
Returns itself.
goto
-
frame
-
[name]
Goes to a frame and starts playing the animation from there. You can optionally pass the name of a new aniamtion to start playing.
Parameters:
-
frame
NumberThe index of the frame to start on
-
[name]
String optionalThe string name of the animation to go to
Returns:
Returns itself.
off
-
type
-
listener
Removes a listener function for an event type
Parameters:
-
type
StringThe event name to emit
-
listener
FunctionThe function to remove
Returns:
Returns itself.
on
-
type
-
listener
Registers a listener function to be run on an event occurance
Parameters:
-
type
StringThe event name to listen for
-
listener
FunctionThe function to execute when the event happens
Returns:
Returns itself.
once
-
type
-
listener
Registers a one-time callback for an event
Parameters:
-
type
StringThe event name to listen for
-
listener
Functionthe callback to call when the event occurs
Returns:
Returns itself.
play
()
Sprite
chainable
Starts playing the currently active animation
Returns:
Returns itself.
stop
()
Sprite
chainable
Stops playing the currently active animation
Returns:
Returns itself.
updateTransform
()
private
Called by PIXI to update our textures and do the actual animation
Properties
animations
Object
The registerd animations for this AnimatedSprite
currentAnimation
String
The currently playing animation
currentFrame
Number
The current frame being shown
lifetime
Number
private
The lifetime of the sprite. Once it reaches 0 (after being set) the sprite's visible property is set to false, so that it will no longer be rendered. NOT YET IMPLEMENTED
Default: Infinity
loop
Boolean
Whether or not to loop the animations. This can be overriden on a per-animation level
Default: false
name
String
The name of the sprite
Default: ''
playing
Boolean
Whether or not the animation is currently playing
speed
Number
The animation speed for this sprite
Default: 1
Events
click
A callback that is used when the users clicks on the sprite with their mouse
Event Payload:
-
interactionData
InteractionData
complete
Fired when the running animation completes
Event Payload:
-
animation
StringThe animation that has completed
frame
Fired when a new frame of the running animation is shown
Event Payload:
-
animation
StringThe animation name that is playing
-
frameId
NumberThe frame that is being shown
mousedown
A callback that is used when the user clicks the mouse down over the sprite
Event Payload:
-
interactionData
InteractionData
mousemove
A callback that is used when the user moves the mouse while over the sprite
Event Payload:
-
interactionData
InteractionData
mouseout
A callback that is used when the users mouse leaves the sprite
Event Payload:
-
interactionData
InteractionData
mouseover
A callback that is used when the users mouse rolls over the sprite
Event Payload:
-
interactionData
InteractionData
mouseup
A callback that is used when the user releases the mouse that was over the sprite for this callback to be fired the mouse must have been pressed down over the sprite
Event Payload:
-
interactionData
InteractionData
mouseupoutside
A callback that is used when the user releases the mouse that was over the sprite but is no longer over the sprite for this callback to be fired, The touch must have started over the sprite
Event Payload:
-
interactionData
InteractionData
tap
A callback that is used when the users taps on the sprite with their finger basically a touch version of click
Event Payload:
-
interactionData
InteractionData
touchend
A callback that is used when the user releases a touch over the sprite
Event Payload:
-
interactionData
InteractionData
touchendoutside
A callback that is used when the user releases the touch that was over the sprite for this callback to be fired, The touch must have started over the sprite
Event Payload:
-
interactionData
InteractionData
touchstart
A callback that is used when the user touch's over the sprite
Event Payload:
-
interactionData
InteractionData