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

Method update

script.js:412–444  ·  view source on GitHub ↗
(change, ref_time)

Source from the content-addressed store, hash-verified

410 }
411
412 update(change, ref_time) {
413 let f = this.getFrame(ref_time);
414 if (!f) {
415 return;
416 }
417 let index = this.getIndex(ref_time);
418 if (change.scale) {
419 const old_scale = f[2];
420 const new_scale = f[2] * change.scale;
421 let delta_x = ((this.width * old_scale) - (this.width * new_scale)) / 2;
422 let delta_y = ((this.height * old_scale) - (this.height * new_scale)) / 2;
423 this.frames[index][0] = f[0] + delta_x;
424 this.frames[index][1] = f[1] + delta_y;
425 this.frames[index][2] = new_scale;
426 this.interpolate(index);
427 this.set_anchor(index);
428 }
429 if (change.x) {
430 this.frames[index][0] = change.x;
431 this.interpolate(index);
432 this.set_anchor(index);
433 }
434 if (change.y) {
435 this.frames[index][1] = change.y;
436 this.interpolate(index);
437 this.set_anchor(index);
438 }
439 if (change.rotation) {
440 this.frames[index][3] = f[3] + change.rotation;
441 this.interpolate(index);
442 this.set_anchor(index);
443 }
444 }
445
446 // moveable layers have anchor points we'll want to show
447 render_time(ctx, y_coord, base_width, selected) {

Callers

nothing calls this directly

Calls 4

getFrameMethod · 0.95
getIndexMethod · 0.95
interpolateMethod · 0.95
set_anchorMethod · 0.95

Tested by

no test coverage detected