Skip to content
Ryc O'Chet edited this page Feb 1, 2018 · 1 revision
- NOTE: This documentation is for Velocity v2.

Option: Delay

Specify the delay option in milliseconds to insert a pause before an animation begins. The delay option exists so that animation logic can be kept entirely within Velocity.

You can set the delay option alongside the loop or repeat options to create a pause between each iteration:

element.velocity({
    height: ["10em", "5em"]
}, {
    loop: 4,
    /* Wait 100ms before each direction. */
    delay: 100
});

You can specify a negative number to tell it to start the animation from a later point, this will reduce the duration of the animation accordingly.

element.velocity({
    height: ["10em", "5em"]
}, {
    duration: 1000,
    /* Start the animation at 40%, and only run for a total of 600ms. */
    delay: -400
});