Skip to content

[Custom Highlight API Extensions] Animated gradient over the range #1435

Open

Description

Robert Flack (@flackr) wrote:

I wonder if instead of per range styles you could think of the effect as a sort of animated gradient over the entire range instead. Then we wouldn't need per range styles which would significantly reduce the complexity and cost of these animations. I know the typical effect is a swiping reveal - are there any use cases which couldn't be represented as an animated gradient over the range?

Note this gradient could be discretized at the character boundary so that you're not applying an actual gradient to the individual characters but does mean that a wave of characters appearing would be a single animation rather than needing separate styles and animations for each individual text range.

Activity

  1. kbabbitt commented on Nov 3, 2026

    @kbabbitt
    MemberAuthor

    I did bring up the idea of a sliding gradient style fade internally but was told that a true word-by-word effect was a design goal.

    Or are you suggesting some sort of mathematical "gradient" where, say, we animate a single variable, then do a bunch of math on that to feed it into the opacity values for individual word fades? I'm imagining something like:

    • register a custom property of type <number>, call it --progress
    • animate --progress from 0 to 1 or whatever
    • set opacity to some calc() expression that's a function of --progress and the word index

    The range-index() function suggested to me in conversations at TPAC would help with that; I'm adding it to the explainer here: #1437

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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