-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Option Repeat
Ryc O'Chet edited this page Feb 1, 2018
·
1 revision
- NOTE: This documentation is for Velocity v2.
Set the repeat
option to an integer to specify the number of times an animation should run. Unlike loop
this repeats start to finish, and doesn't run back down to start again:
// Increase the height from 5em and 10em twice.
element.velocity({ height: ["10em", "5em"] }, { repeat: 2 });
If the begin or complete callbacks are used with a repeated call, they are triggered once each - at the very beginning of the first animation and when the repeat finishes or is stopped, respectively. They are not re-triggered for each iteration.
Instead of passing in an integer, you can pass in true
to trigger infinite repeating:
element.velocity({ height: ["10em", "5em"] }, { repeat: true });
Be sure to stop one infinite repetition before triggering another on the same element. A repeat can be stopped with the "stop"
and "finish"
commands.
See also: [loop
](Option - Loop.md)