Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord

Phaser . Curves . MoveTo

This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord

Phaser . Curves . MoveTo

A MoveTo Curve is a very simple curve consisting of only a single point. Its intended use is to move the ending point in a Path.

Constructor:

new MoveTo([x], [y])

Parameters:

name type arguments description
x number <optional>

x pixel coordinate.

y number <optional>

y pixel coordinate.

Since: 3.0.0
Source: src/curves/path/MoveTo.js (Line 10)

Members

active: boolean
Focus
Focus

Description:

Denotes that this Curve does not influence the bounds, points, and drawing of its parent Path. Must be false or some methods in the parent Path will throw errors.

Type:
boolean
Default: false
Since: 3.0.0
Source: src/curves/path/MoveTo.js (Line 29)
Focus
Focus

Description:

The lone point which this curve consists of.

Type:
Since: 3.0.0
Source: src/curves/path/MoveTo.js (Line 39)
Focus
Focus

Methods

getLength()
Focus
Focus

Description:

Gets the length of this curve.

Returns:
Description:

The length of this curve. For a MoveTo the value is always 0.

Type:
  • number
Examples:
Since: 3.0.0
Focus
Focus
getPoint(t, [out])
Focus
Focus

Description:

Get point at relative position in curve according to length.

Parameters:

name type arguments description
t number

The position along the curve to return. Where 0 is the start and 1 is the end.

out Phaser.Math.Vector2 <optional>

A Vector2 object to store the result in. If not given will be created.

Returns:
Description:

The coordinates of the point on the curve. If an out object was given this will be returned.

Examples:
Since: 3.0.0
Source: src/curves/path/MoveTo.js (Line 49)
Focus
Focus
getPointAt(u, [out])
Focus
Focus

Description:

Retrieves the point at given position in the curve. This will always return this curve's only point.

Parameters:

name type arguments description
u number

The position in the path to retrieve, between 0 and 1. Not used.

out Phaser.Math.Vector2 <optional>

An optional vector in which to store the point.

Returns:
Description:

The modified out vector, or a new Vector2 if none was provided.

Examples:
Since: 3.0.0
Source: src/curves/path/MoveTo.js (Line 69)
Focus
Focus
getResolution()
Focus
Focus

Description:

Gets the resolution of this curve.

Returns:
Description:

The resolution of this curve. For a MoveTo the value is always 1.

Type:
  • number
Examples:
Since: 3.0.0
Source: src/curves/path/MoveTo.js (Line 87)
Focus
Focus
toJSON()
Focus
Focus

Description:

Converts this curve into a JSON-serializable object.

Returns:
Description:

A primitive object with the curve's type and only point.

Examples:
Since: 3.0.0
Focus
Focus