Version:

# Phaser . GameObjects . Particles . GravityWell

The GravityWell action applies a force on the particle to draw it towards, or repel it from, a single point.

The force applied is inversely proportional to the square of the distance from the particle to the point, in accordance with Newton's law of gravity.

This simulates the effect of gravity over large distances (as between planets, for example).

### Constructor:

``````new GravityWell([x], [y], [power], [epsilon], [gravity])
``````

#### Parameters:

name type arguments Default description
x number | Phaser.Types.GameObjects.Particles.GravityWellConfig <optional> 0

The x coordinate of the Gravity Well, in world space.

y number <optional> 0

The y coordinate of the Gravity Well, in world space.

power number <optional> 0

The strength of the gravity force - larger numbers produce a stronger force.

epsilon number <optional> 100

The minimum distance for which the gravity force is calculated.

gravity number <optional> 50

The gravitational force of this Gravity Well.

Since: 3.0.0

## Members

<private> _epsilon: number

#### Description:

Internal epsilon value.

##### Type:
number
Default: 0
Since: 3.0.0
<private> _gravity: number

#### Description:

Internal gravity value.

##### Type:
number
Since: 3.0.0
<private> _power: number

#### Description:

Internal power value.

number
Default: 0
Since: 3.0.0

#### Description:

The active state of the Gravity Well. An inactive Gravity Well will not influence any particles.

boolean
Default: true
Since: 3.0.0

#### Description:

The minimum distance for which the gravity force is calculated.

number
Since: 3.0.0

#### Description:

The strength of the gravity force - larger numbers produce a stronger force.

number
Since: 3.0.0

#### Description:

The x coordinate of the Gravity Well, in world space.

number
Since: 3.0.0

#### Description:

The y coordinate of the Gravity Well, in world space.

number
Since: 3.0.0

## Methods

update(particle, delta, step)

#### Description:

Takes a Particle and updates it based on the properties of this Gravity Well.

#### Parameters:

name type description
particle Phaser.GameObjects.Particles.Particle

The Particle to update.

delta number

The delta time in ms.

step number

The delta value divided by 1000.

Since: 3.0.0