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;
}
this.location = location;
const value = this.modulators.reduce(
(value, m) => value + m(location / frequency, this),
0,
) / this.modulators.length;
let acc = 0;
for (let i = 0; i < this.modulators.length; i++) {
acc += this.modulators[i](location / frequency, this);
}
const value = acc / this.modulators.length;
this.object[this.key] = this.min + this.factor * value * this.magnitude;
}