Back to Browse

Animating a radial gradient with Framer Motion

16.8K views
Apr 28, 2023
18:57

Learn how to build a spotlight effect by animating a radial gradient that follows the mouse cursor. Built with React, Framer Motion and Tailwind CSS. ๐Ÿ”— LINKS Code: https://buildui.com/recipes/spotlight Motion values: https://www.framer.com/motion/motionvalue/ ๐Ÿ• TIMESTAMPS 0:00 โ€“ Intro 0:21 โ€“ Radial gradient 2:55 โ€“ Tracking the mouse position 7:50 โ€“ Updating the gradient position with React state 9:26 โ€“ Too many re-renders 10:37 โ€“ Refactoring to motion values 13:41 โ€“ Revealing the spotlight on hover 15:30 โ€“ Adding a border glow 16:59 โ€“ย Final demo

Download

0 formats

No download links available.

Animating a radial gradient with Framer Motion | NatokHD