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 worldObject An instance of World. opt_options=Object <optional>
A map of initial properties. opt_options.initialLocationObject <optional>
The center of the world The object's initial location. opt_options.lastLocationObject <optional>
{x: 0, y: 0} The object's last location. Used to calculate angle if pointToDirection = true. opt_options.amplitudeObject <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.accelerationObject <optional>
{x: 0.01, y: 0} The object's acceleration. Oscillators have a constant acceleration. opt_options.aVelocityObject <optional>
new Vector() Angular velocity. opt_options.isStaticboolean <optional>
false If true, object will not move. opt_options.perlinboolean <optional>
false If set to true, object will use Perlin Noise to calculate its location. opt_options.perlinSpeednumber <optional>
0.005 If perlin = true, perlinSpeed determines how fast the object location moves through the noise space. opt_options.perlinTimenumber <optional>
0 Sets the Perlin Noise time. opt_options.perlinAccelLownumber <optional>
-2 The lower bound of acceleration when perlin = true. opt_options.perlinAccelHighnumber <optional>
2 The upper bound of acceleration when perlin = true. opt_options.offsetXnumber <optional>
Math.random() * 10000 The x offset in the Perlin Noise space. opt_options.offsetYnumber <optional>
Math.random() * 10000 The y offset in the Perlin Noise space. opt_options.widthnumber <optional>
20 Width. opt_options.heightnumber <optional>
20 Height. opt_options.colorArray <optional>
200, 100, 0 Color. opt_options.borderWidthnumber <optional>
this.width / 4 Border width. opt_options.borderStylestring <optional>
'solid' Border style. opt_options.borderColorArray <optional>
255, 150, 0 Border color. opt_options.borderRadiusnumber <optional>
100 Border radius. opt_options.boxShadowSpreadnumber <optional>
this.width / 4 Box-shadow spread. opt_options.boxShadowColorArray <optional>
147, 199, 196 Box-shadow color. - Source:
-
step()
-
Updates the oscillator's properties.
- Source: