API Reference

Class List

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.

Summary

Properties

atlasThe texture atlas.
frameKeysThe keys of the frames in the sprite atlas that this sprite is using.
meshesAn array that contains a mesh for each frame.
options.frameKeysThe keys of the frames in the sprite atlas that this sprite is using.
pixelsPerUnitThe number of pixels that map to one PlayCanvas unit.
renderModeThe rendering mode of the Sprite.

Methods

destroyFree up the meshes created by the sprite.

Details

Constructor

Sprite(device, options)

Parameters

devicepc.GraphicsDeviceThe graphics device of the application.
optionsObjectOptions for creating the pc.Sprite.
options.pixelsPerUnitNumberThe number of pixels that map to one PlayCanvas unit.
options.renderModepc.SPRITE_RENDERMODEThe rendering mode of the Sprite.
options.atlaspc.TextureAtlasThe texture atlas.

Properties

pc.TextureAtlasatlas

The texture atlas.

String[]frameKeys

The keys of the frames in the sprite atlas that this sprite is using.

pc.Mesh[]meshes

An array that contains a mesh for each frame.

String[]options.frameKeys

The keys of the frames in the sprite atlas that this sprite is using.

NumberpixelsPerUnit

The number of pixels that map to one PlayCanvas unit.

pc.SPRITE_RENDERMODErenderMode

The rendering mode of the Sprite.

Methods

destroy()

Free up the meshes created by the sprite.