new Oscillator()
Creates a new Oscillator.
Oscillators simulate wave patterns and move according to
amplitude and angular velocity. Oscillators are not affected
by gravity or friction.
- Source:
Extends
- Item
Methods
-
init(world, opt_options=)
-
Initializes Oscillator.
Parameters:
Name Type Argument Default Description world
Object An instance of World. opt_options=
Object <optional>
A map of initial properties. opt_options.initialLocation
Object <optional>
The center of the world The object's initial location. opt_options.lastLocation
Object <optional>
{x: 0, y: 0} The object's last location. Used to calculate angle if pointToDirection = true. opt_options.amplitude
Object <optional>
{x: world width, y: world height} Sets amplitude, the distance from the object's initial location (center of the motion) to either extreme. opt_options.acceleration
Object <optional>
{x: 0.01, y: 0} The object's acceleration. Oscillators have a constant acceleration. opt_options.aVelocity
Object <optional>
new Vector() Angular velocity. opt_options.isStatic
boolean <optional>
false If true, object will not move. opt_options.perlin
boolean <optional>
false If set to true, object will use Perlin Noise to calculate its location. opt_options.perlinSpeed
number <optional>
0.005 If perlin = true, perlinSpeed determines how fast the object location moves through the noise space. opt_options.perlinTime
number <optional>
0 Sets the Perlin Noise time. opt_options.perlinAccelLow
number <optional>
-2 The lower bound of acceleration when perlin = true. opt_options.perlinAccelHigh
number <optional>
2 The upper bound of acceleration when perlin = true. opt_options.offsetX
number <optional>
Math.random() * 10000 The x offset in the Perlin Noise space. opt_options.offsetY
number <optional>
Math.random() * 10000 The y offset in the Perlin Noise space. opt_options.width
number <optional>
20 Width. opt_options.height
number <optional>
20 Height. opt_options.color
Array <optional>
200, 100, 0 Color. opt_options.borderWidth
number <optional>
this.width / 4 Border width. opt_options.borderStyle
string <optional>
'solid' Border style. opt_options.borderColor
Array <optional>
255, 150, 0 Border color. opt_options.borderRadius
number <optional>
100 Border radius. opt_options.boxShadowSpread
number <optional>
this.width / 4 Box-shadow spread. opt_options.boxShadowColor
Array <optional>
147, 199, 196 Box-shadow color. - Source:
-
step()
-
Updates the oscillator's properties.
- Source: