-
Notifications
You must be signed in to change notification settings - Fork 0
/
WaveData.js
64 lines (57 loc) · 1.71 KB
/
WaveData.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
module.exports = {
// Wave Data Object
WaveData: function() {
this.Order = null;
this.Radians = null;
this.Tau = null;
this.Sin = null;
this.Cos = null;
this.Tan = null;
this.Sinh = null;
this.Cosh = null;
this.Tanh = null;
},
WaveDataCompound: function() {
this.Order = null;
this.Multiplier = null;
this.Radians = null;
this.Tau = null;
this.Sin = null;
this.Cos = null;
this.Tan = null;
this.Sinh = null;
this.Cosh = null;
this.Tanh = null;
},
// creates a new wave event
NextWave: function(multiplier, order) {
radians = (order * Math.PI) / 32 + 1;
newWave = new this.WaveData();
newWave.Order = order;
newWave.Radians = radians;
newWave.Tau = radians / (2 * Math.PI);
newWave.Sin = multiplier * Math.sin(radians);
newWave.Cos = multiplier * Math.cos(radians);
newWave.Tan = multiplier * Math.tan(radians);
newWave.Sinh = multiplier * Math.sinh(radians);
newWave.Cosh = multiplier * Math.cosh(radians);
newWave.Tanh = multiplier * Math.tanh(radians);
return newWave;
},
// creates a new wave event
NextWaveCompound: function(order, multiplier) {
radians = order * 2 * Math.PI;
newWave = new this.WaveDataCompound();
newWave.Order = order;
newWave.Multiplier = multiplier;
newWave.Radians = radians;
newWave.Tau = radians / (2 * Math.PI);
newWave.Sin = multiplier * Math.sin(radians);
newWave.Cos = multiplier * Math.cos(radians);
newWave.Tan = multiplier * Math.tan(radians);
newWave.Sinh = multiplier * Math.sinh(radians);
newWave.Cosh = multiplier * Math.cosh(radians);
newWave.Tanh = multiplier * Math.tanh(radians);
return newWave;
}
};