Canvas alias
The canvas alias is a way to reference a component in the canvas by a name. This name is used to reference the component in the script.
The alias is unique, if a component is added using an existing alias the new component will replace the old one.
The alias corresponds to PixiJSComponent.label
, so do not modify label
, use the methods provided by Pixi’VN.
Heredity factor
If a component is added using an existing alias the new component, in addition to replacing the old one, will inherit the properties, the zIndex and the tickers of the old component.
Edit canvas component alias
To edit the alias of a canvas component, you can use the canvas.editAlias
. If the alias has a or more tickers associated, it will be automatically edited in the ticker.
The editAlias
method have the following parameters:
oldAlias
: The old alias of the component to edit.newAlias
: The new alias of the component.
import { canvas } from '@drincs/pixi-vn'
canvas.editAlias('sprite1', 'sprite2')
Stage alias
In PixiJS the stage is a component that manages all the layers in its scene tree. It can be considered the entire window that contains all the elements.
This component has been assigned a special alias, CANVAS_APP_STAGE_ALIAS
, which is used to reference the stage in the script.
This is very useful if you want to run some animations or effects at the entire window. Not all features are allowed with this alias, such as deleting.
import { CANVAS_APP_STAGE_ALIAS, shakeEffect } from '@drincs/pixi-vn'
shakeEffect(CANVAS_APP_STAGE_ALIAS)