MCPcopy Create free account
hub / github.com/melonjs/melonJS / update

Method update

packages/spine-plugin/src/Spine.js:371–394  ·  view source on GitHub ↗

* Update function (automatically called by melonJS). * @param {number} dt - time since the last update in milliseconds. * @returns {boolean} true if the renderable is dirty

(dt)

Source from the content-addressed store, hash-verified

369 * @returns {boolean} true if the renderable is dirty
370 */
371 update(dt) {
372 if (typeof this.skeleton !== "undefined") {
373 const deltaSeconds = dt / 1000;
374
375 // advance skeleton time for physics simulation
376 this.skeleton.update(deltaSeconds);
377
378 // update and apply the animation state
379 this.animationState.update(deltaSeconds);
380 this.animationState.apply(this.skeleton);
381
382 // position the skeleton (added directly to root worldX/worldY,
383 // bypassing Skeleton.yDir scaling that would flip a rootBone.pose.y)
384 this.skeleton.x = this.pos.x;
385 this.skeleton.y = this.pos.y;
386
387 // world transforms
388 this.skeleton.updateWorldTransform(Physics.update);
389
390 // update Bounds
391 this.updateBounds();
392 }
393 return true;
394 }
395
396 /**
397 * Draw this Spine object using the appropriate renderer.

Callers 4

stepFunction · 0.45
placeBoxFunction · 0.45
flushFunction · 0.45
parity.spec.tsFile · 0.45

Calls 2

updateBoundsMethod · 0.95
applyMethod · 0.45

Tested by 3

stepFunction · 0.36
placeBoxFunction · 0.36
flushFunction · 0.36