Answer the question
In order to leave comments, you need to log in
How to set up JS code for animation?
I asked this question -
"Hello. There is a Canvas animation made in Adobe Animate CC, when the page loads, the animation plays automatically and when you get to it, you see only the picture with the final result.
How to make the animation play only when it comes into view screen?"
I received a code in response with a note -
"This animation has a launch function, you need to postpone it until the block appears in the scope."
var $animationBlock = $('_selector_to_element');
var $window = $(window);
$window.on('scroll', function(){
if ($animationBlock.offset().top >= $window.scrollTop()){
// animation function
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question