Bramus Profile picture
Oct 4 9 tweets 4 min read
What if I told you this demo right here is powered by nothing but HTML and CSS?

Yep that’s right, not a single line of JavaScript (*) in sight! 🤩

Demo on @CodePen: codepen.io/bramus/full/GR…

(*) Except for a polyfill that’s being loaded
The demo uses Scroll-Snapping, CSS Reflections (using the proprietary `-webkit-box-reflect`), and Scroll-Linked Animations.

With Scroll-Linked Animations, it’s possible to drive a CSS Animation by scroll: as you scroll, an animation moves forwards/backwards along with it.
In this demo, we track each album cover as they enter and exit the scrollport (enter from the left, exit on the right).

To do this we use a `view-timeline` which can be compared to how IntersectionObserver tracks elements.

```css
li {
view-timeline: li-timeline inline;
}
```
The images themselves are animated using a set of CSS keyframes. We link these keyframes to the ViewTimeline using the `animation-timeline` CSS property.

```css
li img {
animation: rotate-and-show-cover linear forwards;
animation-timeline: li-timeline;
}
```
Scroll-Linked Animations are actively being worked on by our Chrome engineers, and should land later this year / early next year.

It took some time, as the spec underwent a MAJOR rewrite (you might remember prev @​scroll-timeline demos from me; that syntax is deprecated)
The folks from Firefox are also working on it, but I don’t know when they are aiming to ship.

To plug any holes, our engineers are also working on a polyfill which is catching up with the latest spec changes. You can already use it, but know it’s in flux. github.com/flackr/scroll-…
There’s much more stuff you can do with it (such as tracking various phases, or tracking a scroller’s progress in general) but that’s food for an upcoming blogpost … or maybe even an #HTTP203 episode 😉
All album covers used in the demo are from the wonderful @LociRecords label their catalogue.

If you’re into downtempo / electronic music, be sure to check them out. Recommended starter album: the “Season Two” compilation.

locirecords.bandcamp.com/album/season-t…
* Correction, now that I reread this thread: got my sides mixed up in an earlier tweet 🤦‍♂️

The covers enter the scrollport from the right, and exit it on the left. You can see what’s happening when enabling debug mode. The blue outlines are the <li>s being scrolled in the <ul>

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Bramus

Bramus Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @bramus

Sep 26
🎉🥳 Good news everyone! The Large, Small and Dynamic viewport units (lv*, sv*, dv*) are coming to Chrome 108!

I2S announcement: groups.google.com/a/chromium.org… Illustration showing the 10...
Now you might be wondering: “What took Chrome so long?!”

Well, if you’ve watched my #HTTP203 episode on Viewports () you know that there currently is a difference between browsers on how they handle the Virtual Keyboard.
Today, some browsers resize the Layout Viewport (and therefore ICB as well), while some don’t.

This difference in ICB resize behavior affects the Viewport Units. Illustration showing the 10...
Read 8 tweets
Dec 30, 2021
At the start of 2021, I discovered CSS @​scroll-timeline, a way to link CSS Animations to the scroll offset of a scroll container.

Seems fitting to close off the year with a final demo: reverse-scrolling columns.

🔗 codepen.io/bramus/pen/jOG…

🧵
In browsers that support CSS Scroll-Timeline (which is only Chromium with “Experimental Web Platform Features” enabled for now) the effect is achieved using nothing but CSS. /* Set up Animation */ @keyframes adjust-position {   from {
In browsers that don't support CSS Scroll-Timeline a JavaScript polyfill is loaded and used. The animations themselves are regular WAAPI animations, extended with a linked ScrollTimeline instance. // Polyfill for browsers with no Scroll-Timeline support imp
Read 6 tweets
Dec 27, 2021
🔥 CSS Features to start learning, as I expect them to ship in all browsers in 2022:

1. Container Queries
2. Cascade Layers
3. Color Functions
4. Viewport Units
5. :has()
6. Overscroll Behaviour
7. Subgrid
8. Accent Color
9. Media Query Ranges
1. Container Queries allow authors to style elements according to the size or appearance of a container. For size-based container queries, this is similar to a @​media query, except that it will evaluate against the size of a parent container instead of the viewport.
2. With Cascade Layers, you can control cascade ordering for same-origin rules properly. You do this by layering your styles using the @​layer at-rule. Layers appear before specificity and order of appearance in the cascade.
Read 12 tweets
Jun 8, 2021
🔥🔥🔥

`document.documentTransition` is a new experimental API in @ChromiumDev that allows you to create transitions between two different visual frames.

🔗 chromestatus.com/feature/519300…

Let's dig in … 🧵
@ChromiumDev In this example you see the API transition between the frame with the avatar and the frame with the info modal. The transition — including "slide up" animation — is handled by the API/browser.

🔗 codepen.io/bramus/pen/rNj…

This is called a Root Transition.
@ChromiumDev To make it work, you need to perform 3 steps:

1. Capture the begin frame
2. Make UI changes (which are not rendered on screen)
3. Transition to the new (target) frame
Read 11 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(