Skip to content

Container

Creates a Container

A Container is the base component for all components that render to the screen. It can be used on its own, but components such as Sprite or Graphics will be composed of Containers

When child components are rendered inside, their coordinates become local to the parent Container.

API

Container Attributes

NameTypeDefaultDescription
widthnumberThe width of the Container
heightnumberThe height of the Container
position

number array object

0The position of the Container
xnumber0The x coordinate of the Container
ynumber0The y coordinate of the Container
pivot

number array object

0The pivot point of the Container that it rotates around.
pivot-xnumber0The x pivot point of the Container that it rotates around.
pivot-ynumber0The y pivot point of the Container that it rotates around.
scale

number array object

1The scale of the Container
scale-xnumber1The x scale of the Container
scale-ynumber1The y scale of the Container
skew

number array object

0The skew of the Container
skew-xnumber0The x skew of the Container
skew-ynumber0The y skew of the Container
rotationnumber0The rotation of the Container
event-modeenum'auto'The event mode of the Container
alphanumber1The opacity of the Container
maskobjectundefinedThe mask of the Container
hit-areaobjectundefinedThe hit area of the Container

more attributes in PIXI.Container

Container Events

NameTypeDescription
addedfunctionwhen the Container is added to the stage
child-addedfunctionwhen a child is added to the Container
child-removedfunctionwhen a child is removed from the Container
removedfunctionwhen the Container is removed from the stage
renderfunctioncustom rendering listener
click
functionwhen the Container is clicked
mousedown
functionwhen the mouse button is pressed down on the Container
mouseup
functionwhen the mouse button is released over the Container
mouseover
functionwhen the mouse cursor moves over the Container
mouseout
functionwhen the mouse cursor moves out of the Container
mousemove
functionwhen the mouse cursor moves while over the Container
mouseupoutside
functionwhen the mouse button is released outside the Container
pointercancelfunctionwhen a pointer event is canceled
pointerdownfunctionwhen a pointer down event is detected
pointermovefunctionwhen a pointer move event is detected
pointeroutfunctionwhen a pointer leaves event is detected
pointeroverfunctionwhen a pointer over event is detected
pointertapfunctionwhen a pointer tap event is detected
pointerupfunctionwhen a pointer up event is detected
pointerupoutsidefunctionwhen a pointer up outside event is detected
tabfunctionwhen a tab event is detected
touchcancelfunctionwhen a touch cancel event is detected
touchendfunctionwhen a touch end event is detected
touchendoutsidefunctionwhen a touch end outside event is detected
touchmovefunctionwhen a touch move event is detected
touchstartfunctionwhen a touch start event is detected

more events in PIXI.Container

Graphics Slots

NameDescription
defaultThe default slot is used to render the children of the Container element.