ConstraintPositionToNode class

A Constraint that constrains the position of a node to equal the position of another node, optionally with dampening.

Inheritance

Constructors

ConstraintPositionToNode({required Node targetNode, double? dampening, Offset offset = Offset.zero})
Creates a new Constraint that constrains the poistion of a node to be equal to the position of the targetNode. Optionally an offset can be used and also dampening. The targetNode doesn't need to have the same parent, but they need to be added to the same SpriteBox.

Properties

dampening double?
Dampening used when following the targetNode, value between 0.0 and 1.0.
final
hashCode int
The hash code for this object.
no setterinherited
offset Offset
Offset to the target node.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
targetNode Node
Target node to follow.
final

Methods

constrain(Node node, double dt) → void
Called after update is complete, if the constraint has been added to a Node. Override this method to modify the node's property according to the constraint.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
preUpdate(Node node, double dt) → void
Called before the node's update method is called. This method can be overridden to create setup work that needs to happen before the the node is updated, e.g. to calculate the node's speed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited