I’m wondering how to achieve the following scroll animation, Where the STRATEGY and CREATIVE copy dock to the top and then animate while the user scroll, and when the animation is done, the page continue to scroll.
Please see page example here: https://www.mrsandmr.com/
What is this called in theory.
Thanks
Advertisement
Answer
I recently did some research on this as well, mainly inspired by the impressive web design on Apple product pages, like this one.
Here is a nice article I’ve found on Medium, which explains how to achieve such scrolling animations: How to jazz up your website like Apple with JavaScript
The result is available on the demo page here.
As summarized in the TL;DR section:
To sum it all up, the mechanism of how it works is really just: 1. A scrolling container 2. position: sticky;elements 3. JavaScript that converts scroll position of the scrolling container to styles for sticky elements 4. (Sometimes) CSS transition property
Animation logic for strategy/creative on “Mrs&Mr”
I would break it down to the following animation phases:
translateX
from the outside (relative to scroll position) until the 2 elements reach the center of the viewport- Now
rotate
until 180° again relative to scroll position - Again,
translate
but out of the viewport