refactor: opt

This commit is contained in:
cha0s 2021-07-06 19:11:57 -05:00
parent 5f15e46234
commit 4479364b26

View File

@ -115,10 +115,11 @@ export default class ModulatedProperty extends decorate(Class) {
location -= frequency; location -= frequency;
} }
this.location = location; this.location = location;
const value = this.modulators.reduce( let acc = 0;
(value, m) => value + m(location / frequency, this), for (let i = 0; i < this.modulators.length; i++) {
0, acc += this.modulators[i](location / frequency, this);
) / this.modulators.length; }
const value = acc / this.modulators.length;
this.object[this.key] = this.min + this.factor * value * this.magnitude; this.object[this.key] = this.min + this.factor * value * this.magnitude;
} }