Reference saveGif()

saveGif()

Generates a gif from a sketch and saves it to a file.

saveGif() may be called in setup() or at any point while a sketch is running.

The first parameter, fileName, sets the gif's file name.

The second parameter, duration, sets the gif's duration in seconds.

The third parameter, options, is optional. If an object is passed, saveGif() will use its properties to customize the gif. saveGif() recognizes the properties delay, units, silent, notificationDuration, and notificationID.

Examples

Syntax

saveGif(filename, duration, [options])

Parameters

filename
String:

file name of gif.

duration
Number:

duration in seconds to capture from the sketch.

options
Object:

an object that can contain five more properties: delay, a Number specifying how much time to wait before recording; units, a String that can be either 'seconds' or 'frames'. By default it's 'seconds’; silent, a Boolean that defines presence of progress notifications. By default it’s false; notificationDuration, a Number that defines how long in seconds the final notification will live. By default it's 0, meaning the notification will never be removed; notificationID, a String that specifies the id of the notification's DOM element. By default it’s 'progressBar’.

Notice any errors or typos? Please let us know. Please feel free to edit src/image/loading_displaying.js and open a pull request!

Related References