You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Custom Highlight API Extensions] Animated gradient over the range #1435
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.
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
Activity
kbabbitt commentedon Nov 3, 2026
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:
<number>, call it --progressThe range-index() function suggested to me in conversations at TPAC would help with that; I'm adding it to the explainer here: #1437