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

Method flicker

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

* make the object flicker * @param {number} duration - expressed in milliseconds * @param {Function} [callback] - Function to call when flickering ends * @returns {Sprite} Reference to this object for method chaining * @example * // make the object flicker for 1 second * // and then remo

(duration, callback = undefined)

Source from the content-addressed store, hash-verified

473 * });
474 */
475 flicker(duration, callback = undefined) {
476 this._flicker.duration = duration;
477 if (this._flicker.duration <= 0) {
478 this._flicker.isFlickering = false;
479 this._flicker.callback = undefined;
480 this._flicker.elapsed = 0;
481 } else {
482 this._flicker.callback = callback;
483 this._flicker.elapsed = 0;
484 this._flicker.isFlickering = true;
485 }
486 return this;
487 }
488
489 /**
490 * add an animation <br>

Callers 4

updateMethod · 0.95
hurtMethod · 0.80
hurtMethod · 0.80
onMouseDownMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected