Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Latest commit

 

History

History
30 lines (24 loc) · 749 Bytes

onfinish.md

File metadata and controls

30 lines (24 loc) · 749 Bytes

onfinish()

This Timeline instance method accepts a callback to call when the animation with the highest timing completes.

Syntax

// Obtain an Ani instance and call onfinish()
ani.onfinish(callback);

Parameters

  • callback - Function: The function to call on finish. This function receives no parameters:

Return

  • undefined

Usage

let timeline = new Timeline;
timeline.onfinish().then(() => {
    console.log('The end!');
});
// Duration: 600ms
timeline.add(new Ani(el1, {opacity:0}, {duration: 600}));
setTimeout(() => {
    // Duration: 400ms. But htis will finish last in the timeline
    timeline.add(new Ani(el2, {opacity:0}, {duration: 600}));
}, 300);