The setFrame() method of p5.Image in p5.js library is used to set the index of the currently visible frame of the GIF animation.
setFrame( index )
Parameters: This function accepts a single parameter as mentioned above and described below.
- index: It is a number that denotes the index of the frame to be displayed.
The following libraries are included in the “head” section of the HTML page while implementing the following examples.
Example 1: The examples below illustrates the setFrame() method in p5.js library.
Online editor: https://editor.p5js.org/
Environment Setup: https://www.geeksforgeeks.org/p5-js-soundfile-object-installation-and-methods/
- Convert an image into grayscale image using HTML/CSS
- How to hide “Image not found” icon when source image is not found?
- How to specify an image as a server-side image-map in HTML ?
- p5.Image filter() Method
- p5.Image save() Method
- p5.Image reset() Method
- p5.js Image mask() Method
- p5.js Image getCurrentFrame() Method
- p5.js Image numFrames() Method
- p5.js Image delay() Method
- p5.js Image resize() Method
- How to use animation on favicon image ?
- HTML | Responsive full page image using CSS
- HTML | Mapping Image
- How to resize an image in an HTML 5 canvas ?
- How to convert an HTML element or document into image ?
- How to convert an image to base64 encoding in PHP?
- How to auto-resize an image to fit a div container using CSS?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.