Skip to content

[pointer-animations-1] Pointer timeline ranges #12507

@ydaniv

Description

@ydaniv

This issue presents a new named animation ranges defined in the Pointer-driven animations spec, and builds on top of the concept of Timeline Ranges defined in scroll-animations-1, plus the concept of Animation Range Centering.


Pointer-driven animations introduce new timeline ranges to allow control over the size of the active range, and the interpolation behavior of the timeline, when used together with animation range centering, i.e. the animation-range-center property. These ranges replace the named ranges introduced in Scroll-Driven Animations, with ranges that are more fitting and appropriate for Pointer-Driven Animations.

The spec currently defines the following range names:

fill

  • 0% - start padding edge of the element’s principal box.
  • 100% - end padding edge of the element’s principal box.
  • If center is shifted, then interpolations between 0%-50% and 50%-100% are scaled up/down to fit these ranges.

Example

Image

fit

  • Same size as fill
  • The 0% and 100% points are offset according to the value of the animation-range-center property, so that the point of 50% remains at the center of the range.

Example

Image

cover

  • Largest possible range that fully covers the element’s principal box according to the value of animation-range-center.
  • The farthest side from any padding edge to the 50% point is used, and then that side is mirrored to the other side.

Example

Image

contain

  • Largest possible range that is fully contained within the element’s principal box according to the value of animation-range-center.
  • The closest side from any padding edge to the 50% point is used, and then that side is mirrored to the other side.

Example

Image

Note: It's imperative that ranges are first centered according to animation-range-center, and only then -start and -end ranges are applied to expand/contract the active range, as well as adjust interpolation (where necessary) between edges and the 50% progress point.


Proposal:

I think we have 3 options here:

  1. Accept the above ranges as specced.
  2. It seems to me that mixing different ranges together doesn't really make any sense, so we could improve this in 2 ways:
    1. Allow a single range name for PDAs, so that we only have: <range-name> || <range-start-offset> <range-end-offset>?, and we figure out the longhands for that.
    2. Split the above ranges into more basic start/end edges as: farthest-side, closest-side, and fixed. Then the above becomes:
      • cover -> farthest / farthest.
      • contain -> closest / closest.
      • fill is sort of magical here since it allows automatic flipping between farthest / closest and closest / farthest, the idea is that the offsets are relative to the edges.
      • fit doesn't conform to these names - in this range the edges of the range aren't fixed to the edges of the timeline, instead the distances are fixed and offsets are relative to them.

I think I'm leaning towards 2i. - Allowing a single range name for PDAs. IMO these effects usually have a notion of spatial symmetry to them, so splitting the range to start and end doesn't make much sense in the context of PDAs. On top of that, I think the suggested ranges cover well beyond all the use-cases I could find/imagine.

/cc @flackr @fantasai @bramus

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Thursday Afternoon

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions