Skip to content

graphics

Eloy Villasclaras edited this page Apr 12, 2016 · 2 revisions

<graphics/> renders a Phaser.Graphics in the scene. Graphics objects can only be created under a <game> or <group> node.

The rendering is defined by the children nodes:

The first time a <graphics> node is rendered, it draws all its children. After that, when a new children is added, or an existing one is updated or removed, the graphics object is cleared and drawn again from scratch, including all its children.

On the other hand, updating the <graphics> node properties will not trigger a complete redraw, but simply update the Phaser.Graphics attributes.### Properties

These properties are set when the component is first mounted, and updated in later renders, if their value changes.

Property Notes
scale Sets or updates point scale. It must have format: {x: [number], y: [number]}.
Alternatively, you can use properties:
  • scaleX: [number]
  • scaleY: [number]
assetKey Sets or updates attribute key
angle Sets or updates attribute angle
autocull Sets or updates attribute autocull
checkWorldBounds Sets or updates attribute checkWorldBounds
outOfBoundsKill Sets or updates attribute outOfBoundsKill
alive Sets or updates attribute alive
lifespan Sets or updates attribute lifespan
x Sets or updates attribute x
y Sets or updates attribute y
body This property is protected, and cannot be set manually. The attributes of body can be manipulated by using the properties below body...
bodyImmovable Sets or updates attribute body.immovable
bodyCollideWorldBounds Sets or updates attribute body.collideWorldBounds
bodyBounce Sets or updates point body.bounce. Must have format: {x: [number], y: [number]}.
Alternatively, you can use properties:
  • bodyBounceX: [number]
  • bodyBounceY: [number]
bodyGravity Sets or updates point body.gravity. Must have format: {x: [number], y: [number]}.
Alternatively, you can use properties:
  • bodyGravityX: [number]
  • bodyGravityY: [number]
bodyPhysics
Clone this wiki locally