Search...
onReverseComplete( )
Sets an event handler that runs when the timeline completes playing in the reverse direction.
Description
The event handler set by calling the onReverseComplete()
function runs when a
timeline completes playing in reverse by reaching the beginning.
When a timeline has been set to repeat, the event handler runs at the end of the last repetition and does not run for the preceding repetitions.
If an event handler is already set for onReverseComplete
, setting a new event
handler overrides the one set previously.
To remove an event handler you set previously, call the onReverseComplete()
function and pass null
for the handler
parameter.
Syntax
function onReverseComplete(handler: Function): TimeLine
onReverseComplete Parameters
NAME
TYPE
DESCRIPTION
handler
Function
The name of the function or the function expression to run when the timeline completes playing.
Was this helpful?
Set an event handler that runs when a timeline completes playing in reverse
Copy Code
1import wixAnimationsFrontend from 'wix-animations-frontend';23let timeline = wixAnimationsFrontend.timeline();45// ...67timeline.onReverseComplete( () => {8 // handle timeline reverse completion9 console.log("Timeline has completed playing in reverse.");10} );
Remove the event handler that runs when a timeline completes playing in reverse
Copy Code
1import wixAnimationsFrontend from 'wix-animations-frontend';23let timeline = wixAnimationsFrontend.timeline();45// ...67timeline.onReverseComplete( null );
Display a message when a timeline completes playing in reverse
Copy Code
1import wixAnimationsFrontend from 'wix-animations-frontend';23let timeline = wixAnimationsFrontend.timeline();45$w.onReady( function () {6 const myImage = $w("#myImage");78 timeline9 .add( myImage, {10 "rotate": 360,11 "scale": .5,12 "duration": 100013 } )14 .add( myImage, {15 "opacity": 0,16 "duration": 100017 } )18 .onReverseComplete( () => {19 $w("#messageText").text = "Timeline has completed playing in reverse.";20 } )21 .reverse();22} );