MCPcopy Create free account
hub / github.com/bwasti/mebm / interpolate_frame

Method interpolate_frame

script.js:319–331  ·  view source on GitHub ↗
(f0, f1, weight)

Source from the content-addressed store, hash-verified

317
318 // interpolates f1 into f0
319 interpolate_frame(f0, f1, weight) {
320 if (weight > 1) {
321 weight = 1;
322 } else if (weight < 0) {
323 weight = 0;
324 }
325 let f = new Float32Array(5);
326 f[0] = weight * f0[0] + (1 - weight) * f1[0];
327 f[1] = weight * f0[1] + (1 - weight) * f1[1];
328 f[2] = weight * f0[2] + (1 - weight) * f1[2];
329 f[3] = weight * f0[3] + (1 - weight) * f1[3];
330 return f;
331 }
332
333 // set index, k (of x, y, scale, rot) to val
334 interpolate(index) {

Callers 2

interpolateMethod · 0.95
getFrameMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected