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

Method stop

packages/melonjs/src/renderable/sprite.js:448–461  ·  view source on GitHub ↗

* Stop the current animation or video and reset it to the first frame * (paused). (Use Sprite#pause instead to freeze in place.) * @returns {Sprite} Reference to this object for method chaining

()

Source from the content-addressed store, hash-verified

446 * @returns {Sprite} Reference to this object for method chaining
447 */
448 stop() {
449 this.animationpause = true;
450 if (this.isVideo) {
451 // clear the frame-anim timer/hold flags too (parity with the legacy
452 // unconditional reset), then rewind the video
453 this._frameAnim.resetTimer();
454 this.image.pause();
455 this.image.currentTime = 0;
456 } else {
457 // rewind the frame animation to its first frame
458 this._frameAnim.rewind();
459 }
460 return this;
461 }
462
463 /**
464 * make the object flicker

Callers

nothing calls this directly

Calls 3

resetTimerMethod · 0.80
rewindMethod · 0.80
pauseMethod · 0.45

Tested by

no test coverage detected