Vector2Extension extension

on

Methods

isIdentity() → bool

Available on Vector2, provided by the Vector2Extension extension

Whether the Vector2 is the identity vector or not
isZero() → bool

Available on Vector2, provided by the Vector2Extension extension

Whether the Vector2 is the zero vector or not
lerp(Vector2 to, double t) → void

Available on Vector2, provided by the Vector2Extension extension

Linearly interpolate towards another Vector2
moveToTarget(Vector2 target, double ds) → void

Available on Vector2, provided by the Vector2Extension extension

Smoothly moves this Vector2 in the direction target by a displacement given by a distance ds in that direction.
rotate(double angle, {Vector2? center}) → void

Available on Vector2, provided by the Vector2Extension extension

Rotates the Vector2 with angle in radians rotates around center if it is defined In a screen coordinate system (where the y-axis is flipped) it rotates in a clockwise fashion In a normal coordinate system it rotates in a counter-clockwise fashion
scaleTo(double newLength) → void

Available on Vector2, provided by the Vector2Extension extension

Changes the length of the vector to the length provided, without changing direction.
screenAngle() → double

Available on Vector2, provided by the Vector2Extension extension

Signed angle in a coordinate system where the Y-axis is flipped.
toOffset() → Offset

Available on Vector2, provided by the Vector2Extension extension

Creates an Offset from the Vector2
toPoint() → Point<num>

Available on Vector2, provided by the Vector2Extension extension

Creates a Point from the Vector2
toPositionedRect(Vector2 size) → Rect

Available on Vector2, provided by the Vector2Extension extension

Creates a Rect starting from (x, y) and having the size of the argument Vector2
toRect() → Rect

Available on Vector2, provided by the Vector2Extension extension

Creates a Rect starting in origin and going the Vector2
toSize() → Size

Available on Vector2, provided by the Vector2Extension extension

Creates a Size from the Vector2

Operators

operator %(Vector2 mod) → Vector2

Available on Vector2, provided by the Vector2Extension extension

Modulo/Remainder
operator &(Vector2 size) → Rect

Available on Vector2, provided by the Vector2Extension extension

A rectangle constructor operator.

Static Methods

fromDegrees(double d) → Vector2

Available on Vector2, provided by the Vector2Extension extension

Creates a heading Vector2 with the given angle in degrees.
fromInts(int x, int y) → Vector2

Available on Vector2, provided by the Vector2Extension extension

Create a Vector2 with ints as input
fromRadians(double r) → Vector2

Available on Vector2, provided by the Vector2Extension extension

Creates a heading Vector2 with the given angle in radians.
identity() → Vector2

Available on Vector2, provided by the Vector2Extension extension

Creates a new identity Vector2 (1.0, 1.0).