Class: BHell_Mover_Harmonic

BHell.BHell_Mover_Harmonic()

new BHell_Mover_Harmonic()

Harmonic movement class. Moves in a straight line until a starting position is reached, then follows an harmonic trajectory in the form:

x(t) = A * cos(phi * t + alpha);

y(t) = B * cos(theta * t + beta);

Source:

Extends

Methods

initialize(x, y, a, b, phi, theta, alpha, beta)

Constructor

Parameters:
Name Type Description
x

X coordinate of the movement's center.

y

Y coordinate of the movement's center.

a

Amplitude of the horizontal axis.

b

Amplitude of the vertical axis.

phi

Angular speed of the horizontal axis.

theta

Angular speed of the vertical axis.

alpha

Phase of the horizontal axis.

beta

Phase of the vertical axis.

Overrides:
Source:

move(oldX, oldY, speed) → {Array}

Moves in a straight line until the starting position is reached, then follows the harmonic function defined.

Parameters:
Name Type Description
oldX

Old x coordinate.

oldY

Old y coordinate.

speed

Movement speed. In pixels per frame during the linear trajectory, in degrees per frame afterwards.

Overrides:
Source:
Returns:
Type
Array