Skip to content

renderimage

Eloy Villasclaras edited this page Apr 12, 2016 · 1 revision

<renderimage> creates an image or spritesheet into the asset cache; it is rendered using a graphics object. Nodes of this type can only be created under an <assets> node.

This example code shows how to render a sprite sheet that can be later used in a button.

Properties

Property Notes
assetKey Texture identifier in Phaser cache
frameWidth (Optional) frame width for spritesheets
frameHeight (Optional) frame height for spritesheets

If either frameWidth or frameHeight are defined, a spritesheet will be created, using these parameters (defaulting to the rendered graphics width/height) as frame size. Otherwise, an image will be created.

Rendering

A <renderimage> can be rendered using the same children nodes as a <graphics> node:

Clone this wiki locally