Comparing version 0.0.83 to 0.0.84
{ | ||
"name": "ogl", | ||
"version": "0.0.83", | ||
"version": "0.0.84", | ||
"description": "WebGL Library", | ||
@@ -5,0 +5,0 @@ "main": "src/index.mjs", |
@@ -32,5 +32,20 @@ import { Vec3 } from '../math/Vec3.js'; | ||
const weight = isSet ? 1 : this.weight / totalWeight; | ||
const elapsed = (this.loop ? this.elapsed % this.duration : Math.min(this.elapsed, this.duration - 0.001)) + this.startTime; | ||
const elapsed = !this.duration | ||
? 0 | ||
: (this.loop ? this.elapsed % this.duration : Math.min(this.elapsed, this.duration - 0.001)) + this.startTime; | ||
this.data.forEach(({ node, transform, interpolation, times, values }) => { | ||
if (!this.duration) { | ||
let val = tmpVec3A; | ||
let size = 3; | ||
if (transform === 'quaternion') { | ||
val = tmpQuatA; | ||
size = 4; | ||
} | ||
val.fromArray(values, 0); | ||
if (size === 4) node[transform].slerp(val, weight); | ||
else node[transform].lerp(val, weight); | ||
return; | ||
} | ||
// Get index of two time values elapsed is between | ||
@@ -37,0 +52,0 @@ const prevIndex = |
288290
8027