Frames Per Second or "fps" affects the overall speed of an animation and determines the number of images displayed each second. For example, 24fps means that 24 distinct images will be displayed every second for the duration of the animation.
The Animated GIF API has a default frame rate of 1 frame per second. This can be modified by changing the value for the
"fps"
parameter in your requests. A higher value will result in a faster transition between frames.
The sample GIFs below have their fps values set to
"fps": 4
and "fps": 8
respectively.
This
overrides the FPS option and allows you to set a custom transition speed between frames. You can set this by using the
"frame_durations"
parameter in your request. This cannot be used alongside the FPS parameter and should be use instead, should you need to define the duration of each frame.
Note: The API expects an array of values equal to the number frames in your request.
The sample GIF below has it's
"frame_durations" values set to
"frame_durations": [1, 2, 1, 2]
. The GIF has a total of 4 frames, so we've provided an array of 4 values defining the duration of each frame.