Hi,
How can I specify this animation only plays once per page refresh?
To be specific, I would like:
The animation to begin when ViewportEnter, but only play one time.
At the moment it restarts each time I scroll back up the page.
The code I’m using is below:
export function text45_viewportEnter(event) {
//Add your code for this event here:
let startNum = 24999900;
let endNum = 25000000;
const duration = 50; // 1000 milliseconds
$w.onReady( function () {
setInterval(()=> {
countUp();
}, duration);
});
function countUp(){
if (startNum <= endNum ){
$w(‘#text45’).text = startNum.toLocaleString().toString();
startNum++;
}
}
}