Animations, Layout & Design

Triggering video playback on scroll in Framer

Triggering video playback on scroll in Framer

Triggering video playback on scroll in Framer

Justin

·

3:45

·

8.9K views

·

About this lesson

In this lesson, we’re setting up a video that plays on scroll using scroll variants, and we’re keeping the whole workflow super clean and code-free. We'll cover how to place your video, wrap it in a simple component, create paused and playing variants, and then tell Framer exactly when that video should kick in as the user scrolls.

https://www.youtube.com/watch?v=QXmPOjccivI&t=0s Introduction

https://www.youtube.com/watch?v=QXmPOjccivI&t=35s Add Video

https://www.youtube.com/watch?v=QXmPOjccivI&t=83s Create Variants

https://www.youtube.com/watch?v=QXmPOjccivI&t=138s Add the Scroll Interaction

https://www.youtube.com/watch?v=QXmPOjccivI&t=195s Wrap Up

Project Remix Link: https://framer.com/remix/a3Bi1nfl3GEdCTu3kUVk

Sign up: https://framer.link/yt

Follow: https://framer.link/yt-x

Learn: https://framer.link/yt-academy

0:00Videos can add a powerful layer of0:02storytelling to a website. And sometimes0:04the timing of when they start [music] is0:06just as important as the video itself.0:09Instead of having it play right away, we0:11might want that moment of motion to0:13happen further down the page, exactly0:16when it [music] supports the story we're0:17trying to tell. That's why in this0:20video, we're going to look at how to0:22control exactly when a video starts0:24[music] playing as someone scrolls. and0:27we'll do it all without any code.0:33To get started, we'll head to layout and0:35select video or press shiftV on our0:38keyboard and then drag a video component0:41right onto the canvas wherever [music]0:43we want it placed. Now, we'll head over0:46to the properties panel and either0:47upload a video file or paste in the0:50video's URL. I'll be using this really0:52cool animation from Ben Fritz as my0:55example. From here, we can adjust any0:57other settings we need to. For example,1:00I don't need my video to loop. So, I'll1:03set loop to no. With our video set,1:06we'll [music] press command return to1:08wrap the video in a regular frame. And1:11then press shift A to turn that frame1:14into a stack. This sets both the width1:17and [music] the height to fit content,1:19which gives us a clean autosizing1:21container for the [music] video. Next,1:23we'll rightclick our stack and select1:26create component or hit command option K1:29on our keyboard. Then, we'll name our1:32new component. I'll just call it1:34autoplay video. Okay, so now that our1:37video is wrapped inside a new component,1:39we'll create a couple of variants for1:41it. [music] For the first variant, we'll1:43rename it to paused and then head to the1:45video's properties in the right panel to1:48set the playing property to no. Then1:51we'll create a second variant, [music]1:54name it playing, and switch the playing1:56property to yes.1:59Now, keep in mind videos can only2:01autoplay in browsers if they're [music]2:03muted. So, make sure the muted property2:05is set to yes, or else this may not work2:08consistently across browsers. [music]2:10With our variants all set, we'll head2:12back to the canvas to set up the scroll2:14interaction that will switch between2:15them as the video comes into [music]2:17view. So with the component selected,2:20we'll head to the properties panel and2:22under effects, we'll add a scroll2:25variant. [music]2:26From here, we'll set the trigger to2:28layer in view, which tells Frame to swap2:31the variance as the component itself2:34enters the viewport. By default, this2:36uses the center of the component as the2:38reference point. So the trigger fires2:40when the center line crosses the bottom2:43of the viewport. I'm actually going to2:45stick with this for our [music] example2:47because I want at least the top half of2:49the video visible before it starts2:50playing. We can always switch to the top2:53or bottom options if the design needs2:55the video to play earlier or later in2:58the scroll. Now, we'll just set our from3:01variant [music] to paused and our to3:03variant to playing and framer will know3:06to switch [music] states right at the3:08midpoint. And finally, we want to make3:10sure to set replay to no so that [music]3:12the effect trigger only happens once.3:15Now, let's head to preview and see how3:17it works. Just a couple of variants and3:19one scroll trigger, and we have a video3:22that now plays exactly when we want it3:24to, whether that's the top, middle, or3:27bottom of the viewport. [music] It's a3:29simple setup, but it gives the page a3:31more intentional and polished feel as3:33the user scrolls. Thanks for watching3:36and as always, I'll see you in the next3:38video.

Watch on YouTube ↗

More in this topic

Framer Update: Logo Shaders2:05
Framer Update: Logo Shaders
Framer Update12K views · 1 month ago
8 Framer shortcuts you're probably sleeping on4:19
8 Framer shortcuts you're probably sleeping on
Layout & Design3K views · 2 months ago
Framer Update: Holo Shader1:46
Framer Update: Holo Shader
Framer Update6K views · 2 months ago
Framer Update: Stack Sorting and Bento Grids2:16
Framer Update: Stack Sorting and Bento Grids
Framer Update7K views · 2 months ago
Shader: Chromatic Aberration1:56
Shader: Chromatic Aberration
Framer Update7K views · 2 months ago
Framer Shaders2:28
Framer Shaders
Announcement23K views · 2 months ago
Sharing Vector Sets Across Projects (Vectors Lesson 7)3:41
Sharing Vector Sets Across Projects (Vectors Lesson 7)
Layout & Design1K views · 3 months ago
Connecting Vector Sets to the Framer CMS (Vectors Lesson 6)3:38
Connecting Vector Sets to the Framer CMS (Vectors Lesson 6)
Layout & Design2K views · 3 months ago

Create a free website with Framer, the website builder loved by startups, designers and agencies.