new Image(data, localPosArr)
Creates Image Object
Parameters:
Name | Type | Description |
---|---|---|
data | HTMLImageElement | HTMLImageElement object or path to a image |
localPosArr | Array | An array includes local positions and sizes(not required). |
Methods
-
addEventListener(type, callback)
-
Registers an event listener object to EventDispatcher object so that the listener receives the notification.
Parameters:
Name Type Description type String The type of event. callback Function The listener function. -
changeColor(color, density)
-
Changes its color.
Parameters:
Name Type Description color int A color density Number A ratio of its application -
changeScale(xscale, yscale) → {Image}
-
Creates new image in a specified scale.
Parameters:
Name Type Description xscale Number A horizontal scale for a new image yscale Number A vertical scale for a new image Returns:
Image The new Image object -
changeSize(width, height) → {Image}
-
Creates new image in a specified size.
Parameters:
Name Type Description width Number A width for a new image height Number A height for a new image Returns:
Image The new Image object -
dispatchEvent(Event)
-
Dispatches an event to the event flow.
Parameters:
Name Type Description Event arc.Event object -
draw(x, y, rotation)
-
Draws the image.
Parameters:
Name Type Description x Number A horizontal position y Number A vartical position rotation Number A rotation -
drawCrop(x1, y1, width1, height1, x2, y2, width2, height2, rotation)
-
Draws the image within the specified cropping area.
Parameters:
Name Type Description x1 Number A horizontal position of the cropping area y1 Number A vartical position of the cropping area width1 Number A width of the cropping area height1 Number A height of the cropping area x2 Number A horizontal position where to draw the image y2 Number A vartical position where to draw the image width2 Number A width of the image height2 Number A height of the image rotation Number A rotation of the image -
drawSize(x, y, width, height, rotation)
-
Draws the image in a specified size.
Parameters:
Name Type Description x Number A horizontal position y Number A vartical position width Number A width of the image height Number A height of the image rotation Number A rotation -
duplicate() → {Image}
-
Duplicates the image.
Returns:
Image The duplicated image -
getFrameWidth() → {Number}
-
Returns a width of a frame.
Returns:
Number A width of a frame -
getHeight() → {Number}
-
Returns a height.
Returns:
Number A height -
getPath() → {Number}
-
Returns a url of the image
Returns:
Number A URL of the image. -
getWidth() → {Number}
-
Returns a width.
Returns:
Number A width -
removeEventListener(type, callback)
-
Removes a listener from the EventDispatcher object.
Parameters:
Name Type Description type String The type of event. callback Function The listener function. -
setFrameWidth(frameWidth)
-
Sets a width of a frame for a image used for a sprite animation.
Parameters:
Name Type Description frameWidth Number A width of a frame