Class: Sprite

pc.Sprite

A pc.Sprite is contains references to one or more frames of a pc.TextureAtlas. It can be used by the pc.SpriteComponent or the pc.ElementComponent to render a single frame or a sprite animation.

Constructor

new Sprite(device, options)

Parameters:
Name Type Description
device pc.GraphicsDevice The graphics device of the application.
options Object Options for creating the pc.Sprite.
Properties
Name Type Attributes Description
pixelsPerUnit Number <optional>
The number of pixels that map to one PlayCanvas unit.
renderMode pc.SPRITE_RENDERMODE <optional>
The rendering mode of the Sprite.
atlas pc.TextureAtlas <optional>
The texture atlas.
Properties:
Name Type Attributes Description
options.frameKeys Array.<String> <optional>
The keys of the frames in the sprite atlas that this sprite is using.
pixelsPerUnit Number The number of pixels that map to one PlayCanvas unit.
atlas pc.TextureAtlas The texture atlas.
renderMode pc.SPRITE_RENDERMODE The rendering mode of the Sprite.
frameKeys Array.<String> The keys of the frames in the sprite atlas that this sprite is using.
meshes Array.<pc.Mesh> An array that contains a mesh for each frame.
Source:

Methods

destroy()

Free up the meshes created by the sprite.
Source: