The last thing we’ll do is position the, center it, and limit the max-width and height so it does not exceed the dimensions of the viewport. We’ll also match the background color of the document with the background color of our images. In CSS, we’ll give our document a height of 100vh and make our 5⨉ taller than that to give ourselves the necessary scroll length to make this work. The HTML and CSS for this effect is very easy as the magic happens inside the element which we control with JavaScript by giving it an ID. You know, like a flip book! No complex WebGL scenes or advanced JavaScript libraries are needed.īy synchronizing each frame to the user’s scroll position, we can play the animation as the user scrolls down (or back up) the page. The idea is to create an animation just like a sequence of images in rapid succession. Specifically, let’s replicate the AirPods Pro product page and the shifting light effect in the hero image. Let’s take an in-depth look at one of these effects to see how it’s made so you can recreate some of these magical effects in our own projects. Even using the browser’s DevTools won’t always reveal the answer, as it often can’t see past a element. What then, you ask? Well, it can be a little hard to figure out. Just check out this video of the mobile web experience for the iPad Pro: Source: TwitterĪ lot of the effects that you see there aren’t created in just HTML and CSS. For example, as you scroll down the page products may slide into view, MacBooks fold open and iPhones spin, all while showing off the hardware, demonstrating the software and telling interactive stories of how the products are used. Apple is well-known for the sleek animations on their product pages.
0 Comments
Leave a Reply. |