Package | net.flashpunk.graphics |
Class | public class Spritemap |
Inheritance | Spritemap Image Graphic Object |
Subclasses | TiledSpritemap |
Property | Defined By | ||
---|---|---|---|
active : Boolean = false
If the graphic should update. | Graphic | ||
alpha : Number
Change the opacity of the Image, a value from 0 to 1. | Image | ||
angle : Number = 0
Rotation of the image, in degrees. | Image | ||
blend : String
Optional blend mode to use when drawing this image. | Image | ||
callback : Function
Optional callback function for animation end. | Spritemap | ||
clipRect : Rectangle [override] [read-only]
Clipping rectangle for the spritemap. | Spritemap | ||
color : uint
The tinted color of the Image. | Image | ||
columns : uint [read-only]
Columns in the Spritemap. | Spritemap | ||
complete : Boolean = true
If the animation has stopped. | Spritemap | ||
currentAnim : String [read-only]
The currently playing animation. | Spritemap | ||
drawMask : BitmapData
Set the transparency mask of the Image. | Image | ||
flipped : Boolean
If you want to draw the Image horizontally flipped. | Image | ||
frame : int
Sets the current frame index. | Spritemap | ||
frameCount : uint [read-only]
The amount of frames in the Spritemap. | Spritemap | ||
height : uint [read-only]
Height of the image. | Image | ||
index : uint
Current index of the playing animation. | Spritemap | ||
locked : Boolean [read-only]
True if the image is locked. | Image | ||
originX : Number = 0
X origin of the image, determines transformation point. | Image | ||
originY : Number = 0
Y origin of the image, determines transformation point. | Image | ||
rate : Number = 1
Animation speed factor, alter this to speed up/slow down all animations. | Spritemap | ||
relative : Boolean = true
If the graphic should render at its position relative to its parent Entity's position. | Graphic | ||
rows : uint [read-only]
Rows in the Spritemap. | Spritemap | ||
scale : Number = 1
Scale of the image, affects both x and y scale. | Image | ||
scaledHeight : Number
The scaled height of the image. | Image | ||
scaledWidth : Number
The scaled width of the image. | Image | ||
scaleX : Number = 1
X scale of the image. | Image | ||
scaleY : Number = 1
Y scale of the image. | Image | ||
scrollX : Number = 1
X scrollfactor, effects how much the camera offsets the drawn graphic. | Graphic | ||
scrollY : Number = 1
Y scrollfactor, effects how much the camera offsets the drawn graphic. | Graphic | ||
smooth : Boolean
If the image should be drawn transformed with pixel smoothing. | Image | ||
tinting : Number
The amount the image will be tinted, suggested values from
0 to 1. | Image | ||
tintMode : Number
The tint mode - multiply or colorize. | Image | ||
visible : Boolean = true
If the graphic should render. | Graphic | ||
width : uint [read-only]
Width of the image. | Image | ||
x : Number = 0
X offset. | Graphic | ||
y : Number = 0
Y offset. | Graphic |
Method | Defined By | ||
---|---|---|---|
Spritemap(source:*, frameWidth:uint = 0, frameHeight:uint = 0, callback:Function = null)
Constructor. | Spritemap | ||
Add an Animation. | Spritemap | ||
centerOO():void
Centers the Image's originX/Y to its center. | Image | ||
centerOrigin():void
Centers the Image's originX/Y to its center. | Image | ||
clear():void
Clears the image buffer. | Image | ||
createCircle(radius:uint, color:uint = 0xFFFFFF, alpha:Number = 1):Image [static]
Creates a new circle Image. | Image | ||
createGradient(width:uint, height:uint, fromX:Number, fromY:Number, toX:Number, toY:Number, fromColor:uint, toColor:uint, fromAlpha:Number = 1, toAlpha:Number = 1):Image [static]
Creates a new gradient Image. | Image | ||
createRect(width:uint, height:uint, color:uint = 0xFFFFFF, alpha:Number = 1):Image [static]
Creates a new rectangle Image. | Image | ||
getFrame(column:uint = 0, row:uint = 0):uint
Gets the frame index based on the column and row of the source image. | Spritemap | ||
lock():void
Lock the image, preventing updateBuffer() from being run until
unlock() is called, for performance. | Image | ||
Plays an animation. | Spritemap | ||
randFrame():void
Assigns the Spritemap to a random frame. | Spritemap | ||
render(target:BitmapData, point:Point, camera:Point):void
Renders the graphic to the screen buffer. | Graphic | ||
setAnimFrame(name:String, index:int):void
Sets the frame to the frame index of an animation. | Spritemap | ||
setFrame(column:uint = 0, row:uint = 0):void
Sets the current display frame based on the column and row of the source image. | Spritemap | ||
unlock():void
Unlock the image. | Image | ||
update():void
Updates the graphic. | Graphic | ||
updateBuffer(clearBefore:Boolean = false):void [override]
Updates the spritemap's buffer. | Spritemap |
callback | property |
public var callback:Function
Optional callback function for animation end.
clipRect | property |
clipRect:Rectangle
[read-only] [override] Clipping rectangle for the spritemap.
public function get clipRect():Rectangle
columns | property |
columns:uint
[read-only] Columns in the Spritemap.
public function get columns():uint
complete | property |
public var complete:Boolean = true
If the animation has stopped.
currentAnim | property |
currentAnim:String
[read-only] The currently playing animation.
public function get currentAnim():String
frame | property |
frame:int
Sets the current frame index. When you set this, any animations playing will be stopped to force the frame.
public function get frame():int
public function set frame(value:int):void
frameCount | property |
frameCount:uint
[read-only] The amount of frames in the Spritemap.
public function get frameCount():uint
index | property |
index:uint
Current index of the playing animation.
public function get index():uint
public function set index(value:uint):void
rate | property |
public var rate:Number = 1
Animation speed factor, alter this to speed up/slow down all animations.
rows | property |
rows:uint
[read-only] Rows in the Spritemap.
public function get rows():uint
Spritemap | () | Constructor |
public function Spritemap(source:*, frameWidth:uint = 0, frameHeight:uint = 0, callback:Function = null)
Constructor.
Parameterssource:* — Source image.
| |
frameWidth:uint (default = 0 ) — Frame width.
| |
frameHeight:uint (default = 0 ) — Frame height.
| |
callback:Function (default = null ) — Optional callback function for animation end.
|
add | () | method |
public function add(name:String, frames:Array, frameRate:Number = 0, loop:Boolean = true):Anim
Add an Animation.
Parameters
name:String — Name of the animation.
| |
frames:Array — Array of frame indices to animate through.
| |
frameRate:Number (default = 0 ) — Animation speed (with variable framerate: in frames per second, with fixed framerate: in frames per frame).
| |
loop:Boolean (default = true ) — If the animation should loop.
|
Anim — A new Anim object for the animation.
|
getFrame | () | method |
public function getFrame(column:uint = 0, row:uint = 0):uint
Gets the frame index based on the column and row of the source image.
Parameters
column:uint (default = 0 ) — Frame column.
| |
row:uint (default = 0 ) — Frame row.
|
uint — Frame index.
|
play | () | method |
public function play(name:String, reset:Boolean = false, frame:int = 0):Anim
Plays an animation.
Parameters
name:String — Name of the animation to play.
| |
reset:Boolean (default = false ) — If the animation should force-restart if it is already playing.
| |
frame:int (default = 0 ) — Frame of the animation to start from, if restarted.
|
Anim — Anim object representing the played animation.
|
randFrame | () | method |
public function randFrame():void
Assigns the Spritemap to a random frame.
setAnimFrame | () | method |
public function setAnimFrame(name:String, index:int):void
Sets the frame to the frame index of an animation.
Parameters
name:String — Animation to draw the frame frame.
| |
index:int — Index of the frame of the animation to set to.
|
setFrame | () | method |
public function setFrame(column:uint = 0, row:uint = 0):void
Sets the current display frame based on the column and row of the source image. When you set the frame, any animations playing will be stopped to force the frame.
Parameters
column:uint (default = 0 ) — Frame column.
| |
row:uint (default = 0 ) — Frame row.
|
updateBuffer | () | method |
override public function updateBuffer(clearBefore:Boolean = false):void
Updates the spritemap's buffer.
Parameters
clearBefore:Boolean (default = false )
|