Math#sinCosGenerator()

sinCosGenerator(length, sinAmplitude, cosAmplitude, frequency) → {Object}

Generate a sine and cosine table simultaneously and extremely quickly.
The parameters allow you to specify the length, amplitude and frequency of the wave.
This generator is fast enough to be used in real-time.
Code based on research by Franky of scene.at

Parameters
Name Type Description
length number

The length of the wave

sinAmplitude number

The amplitude to apply to the sine table (default 1.0) if you need values between say -+ 125 then give 125 as the value

cosAmplitude number

The amplitude to apply to the cosine table (default 1.0) if you need values between say -+ 125 then give 125 as the value

frequency number

The frequency of the sine and cosine table data

Returns
Object -

Returns the table data.

Source code: math/Math.js (Line 930)
doc_phaser
2017-02-14 10:55:03
Comments
Leave a Comment

Please login to continue.