Motion: [Question] Trigger animation when visible in viewport

Created on 18 Oct 2019  路  3Comments  路  Source: framer/motion

I may have missed it in the documentation, but I wonder if there is the possibility to start an animation once an element is visible in the viewport (animate on scroll).

Thanks!

Most helpful comment

You'd use an intersection observer to trigger the animation, once the element enters view.
https://github.com/thebuilder/react-intersection-observer

Have a recipe here (using react-spring, but same principal):
https://github.com/thebuilder/react-intersection-observer/blob/master/docs/Recipes.md#trigger-animations

All 3 comments

You'd use an intersection observer to trigger the animation, once the element enters view.
https://github.com/thebuilder/react-intersection-observer

Have a recipe here (using react-spring, but same principal):
https://github.com/thebuilder/react-intersection-observer/blob/master/docs/Recipes.md#trigger-animations

@thebuilder wow, that's exactly what I was looking for!

using react-spring, but same principal

Looks like this was even converted over to framer-motion, nice surprise :)

Was this page helpful?
0 / 5 - 0 ratings