Tracks multiple sine waves with different periods and amplitudes, and
returns an instantaneous additive amplitude.
protected var _amps:Array
protected var _incs:Array
protected var _stamp:Number
value:Number
[read-only]
Access the instantaneous value, which can range from
[ -totalAmplitude, totalAmplitude ].
Note: timestamps are only kept relative to the last access of the value,
and floating point math is used, so things could get a little "off" after
a while, and the frequency with which you sample the value will impact
the error. You cope.
Implementation
public function get value():Number
protected var _values:Array
public function Siner(... args)
Parameters
| ... args — amplitude1, period1, amplitude2, period2...
Periods are specified in seconds.
If constructed with more than one amplitude, the amplitudes are
additive.
The Siner will start in the reset() state.
|
public function randomize():void
Randomize the value.
public function reset():void
Reset to 0, with the amplitude about to increase.
protected static const TWO_PI:Number
Copyright © 2007-2009 Three Rings Design, Inc.