Making a Realistic Folding Animation With Framer Motion
In this video we'll be recreating a design I came across on Twitter where Sam created this beautiful folding map component. We'll be using Framer Motion to recreate the same result with very little effort! Make sure to check the live playground linked below to get the code and play around with the map yourself! LINKS: Code and live playground: https://www.frontend.fyi/v/making-a-foldable-map-with-framer-motion Sam's Tweet: https://x.com/samdape/status/1799843696751325304 MORE? ๐ If you want more content like this, become a Frontend FYI PRO and get access to my current and all future courses for a one-time purchase: https://fe.fyi/pro ๐บ If you want to see more videos like these, check out my website: https://fe.fyi/videos โ๏ธ Subscribe to my newsletter: https://fe.fyi/newsletter MY SOCIALS ๐ My website โ https://www.frontend.fyi ๐ฆ Twitter โ https://www.twitter.com/JeroenReumkens ๐ธ Instagram โ https://www.instagram.com/jeroenreumkens ๐ผ Linkedin โ https://www.linkedin.com/in/jeroenreumkens COLLAB Want to work together on creating content? Feel free to reach out via jeroen [at] frontend.fyi WHO AM I? If you're new to this channel โ Hey, my name is Jeroen. A frontend engineer with almost 15 years of professional experience, who in 2023 decided to stop teaching only his close collegeas to start teaching the whole world. What I teach some call Design Engineering, I like to call it the Craft of Frontend. TIMESTAMPS: 00:00 โ Intro 00:30 โ Starting point 01:30 โ Add three column layout 02:13 โ Add map image 03:30 โ Overlap map sections 04:12 โ Explaining the approach to add drag 05:04 โ Add draggable div 07:30 โ Limit how far you can drag 08:25 โ Transform dragged distance into a css transform of the map 10:30 โ Prevent drag trigger area from moving while dragging 11:18 โ Scale center portion of the map when unfolding map 12:17 โ Add shadow to center portion 13:53 โ Skew map for realism 15:25 โ Add crease lines to the map 15:56 โ Add some shadows for even more realism 17:28 โ Make map auto open when you stop dragging 18:34 โ Adding bounce when map opens (using motion variants) 20:26 โ Add some text that appears when map opens 21:22 โ Outro #framermotion #webdevelopment #frontend
Download
1 formatsVideo Formats
Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.