MCPcopy
hub / github.com/processing/p5.js / reset

Method reset

src/image/p5.Image.js:1514–1525  ·  view source on GitHub ↗

* Restarts an animated GIF at its first frame. * * @example * let gif; * * async function setup() { * // Load the image. * gif = await loadImage('assets/arnott-wallace-wink-loop-once.gif'); * * createCanvas(100, 100); * * describe('A cartoon face winks once a

()

Source from the content-addressed store, hash-verified

1512 * }
1513 */
1514 reset() {
1515 if (this.gifProperties) {
1516 const props = this.gifProperties;
1517 props.playing = true;
1518 props.timeSinceStart = 0;
1519 props.timeDisplayed = 0;
1520 props.lastChangeTime = 0;
1521 props.loopCount = 0;
1522 props.displayIndex = 0;
1523 this.drawingContext.putImageData(props.frames[0].image, 0, 0);
1524 }
1525 }
1526
1527 /**
1528 * Gets the index of the current frame in an animated GIF.

Callers 3

keyTypedFunction · 0.45
loading.jsFile · 0.45
p5.Matrix.jsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected