Skip to content

[scroll-animations-1] Phases for taller than scrollport subjects #7973

@bramus

Description

@bramus

Our current approach to the phases

I’ve been working on some visualizations for scroll-animations, to visually show how they are measured. For example, for smaller-than-scrollport-subjects:

image image

For taller-than-scrollport-subjects, simply making the boxes bigger does not work, because that would mean contain 100% comes before contain 0%, which is impossible:

image image

To solve this, we flipped the edge against which the subject is measured (note how the darker line on the center two subjects has flipped sides):

image image

With that, we also shortened the range for enter/exit phases, in order to be able to use 1 set of keyframes that has no overlap between the enter-contain-exit phases:

image image

Limitations of the current approach

This comes with two nasty side-effects imo:

  1. The entry/exit phases are shortened, because phase change detection 
does not happen on the same edge

    image
  2. The meaning of enter and exit changes. This can be troublesome for an element that is initially smaller than the scrollport but becomes taller due to a resize.

This problem becomes clear in a demo such as https://codepen.io/bramus/pen/XWEeGZm no longer possible, where it’s not possible to create it using the new phases.

(FYI: the demo uses a version of the polyfill that measures things differently to make it work after all)

An alternative solution

To solve this, I would like us:

  1. To not change the meaning of enter/exit, and have their measurements be done consistently
  2. Introduce extra phases to allow the current interpretation of enter/exit for taller-than-scrollport-subjects.

Additionally, I also think we have our names wrong, as the current enter 100% for taller-than-scrollport-subjects visually means “it is entirely covering the scrollport”. This does not rhyme well the existing cover.

What I would like to propose, are the following phases. I have added the edge/threshold indicators from earlier versions of the spec as that might make thing easier to understand (this visualization tool of edges and thresholds might come in handy):

  • Smaller than scrollport subjects
    • enter = end 0 → end 1
    • exit = start 1 → start 0
    • contain = end 1 → start 1
    • intersect = end 0 → start 0
  • Taller than scrollport subjects
    • enter = end 0 → end 1
    • enter-cover = end 0 → start “1”
    • exit = start 1 → start 0
    • cover-exit = end ”1’ → start 0
    • cover = start 1 → end 1
    • intersect = end 0 → start 0

These visuals summarize the proposed changes:

image image image

The real ask

Maybe we can do a breakout session on this? Some time in the 2nd half of November maybe? Just before/after a WG meeting?

As you might have noticed by now, I have prepared slides for this :)

/ping All attendees of a previous breakout session: @fantasai @tabatkins @flackr @kevers-google @mirisuzanne @ydaniv @jensimmons @smfr @argyleink

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions