@physion/app / Exports / LightNode
Class: LightNode
A 2D light with shadows.
The light casts rayCount rays from its position, evenly spread over coneAngle, and clips each one at the first body it hits. The clipped rays form a fan that is drawn additively into the Scene's LightLayer, so bodies occlude the light and leave shadows behind them. Each ray fades out toward its end, and a softShadowLength above zero gives the fan a feathered edge past every obstacle.
A light that is a child of a BodyNode follows it and is not blocked by it.
The node's own container only holds the light bulb sprite. The light geometry lives in the Scene's lights layer, in scene coordinates, because the rays are cast in the physics world. Node.alpha works as the light's intensity.
Hierarchy
-
↳
LightNode
Constructors
constructor
• new LightNode(): LightNode
Returns
Overrides
Properties
userData
• userData: Record<string, unknown>
Inherited from
EVT_CHILD_ADDED
▪ Static Readonly EVT_CHILD_ADDED: "childAdded"
The name of the event that is emitted whenever a child is added to this node.
The argument supplied is the child that was just added to this node.
Inherited from
EVT_CHILD_REMOVED
▪ Static Readonly EVT_CHILD_REMOVED: "childRemoved"
The name of the event that is emitted whenever a child is removed from this node.
The argument supplied is the child that was just removed from this node.
Inherited from
EVT_CHILD_REORDERED
▪ Static Readonly EVT_CHILD_REORDERED: "childReordered"
The name of the event that is emitted whenever a child of this node is reordered.
The arguments supplied are: (1) The child that was just reordered (2) the old index of the child and (3) the new index of the child.
Inherited from
EVT_NAME_CHANGED
▪ Static Readonly EVT_NAME_CHANGED: "nameChanged"
The name of the event that is emitted whenever the name of this object changes.
The argument suplied is the new CoreObject.name of the object.
Inherited from
EVT_PROPERTY_CHANGED
▪ Static Readonly EVT_PROPERTY_CHANGED: "propertyChanged"
The name of the event that is emitted whenever a property of this object changes.
The arguments supplied are: (1) The name of the property that has changed and (2) the new value of that property.
Inherited from
EVT_TRANSFORM_CHANGED
▪ Static Readonly EVT_TRANSFORM_CHANGED: "transformChanged"
The name of the event that is emitted whenever the x, y or angle properties of this Node are changed.
Note that this event is not emitted when x, y or angle properties are changed as a result of
an update().
Inherited from
ID_LENGTH
▪ Static Readonly ID_LENGTH: 12
Inherited from
MAX_NAME_LENGTH
▪ Static Readonly MAX_NAME_LENGTH: 128