After being inspired by the sleek web design of Apple product pages, especially this one, I decided to delve into some research on achieving similar scrolling animations.
I came across a helpful Medium article that breaks down how to create these impressive effects using JavaScript: How to jazz up your website like Apple with JavaScript
You can see the result for yourself on the demo page here.
To sum it all up, here's the gist of how it works:
1. Utilize a scrolling container
2. Implement position: sticky; for elements
3. Use JavaScript to adjust styles of sticky elements based on scroll position
4. Optionally, incorporate CSS transition property for smoother animation
Animation logic for strategy/creative on "Mrs&Mr"
To achieve the desired effect, I suggest breaking down the animation process into the following phases:
- Start with a
translateX
movement from outside (relative to scroll position) until the elements reach the center of the viewport
- Next, perform a gradual
rotate
up to 180° relative to scroll position
- Conclude with another
translate
movement out of the viewport