Interpolated Values

Table of Contents

Breakpoints only get you so far. In many cases it would be better to have units and values that can respond more fluidly to context. We can do some of that with relative units (several JS plugins provide container-relative units), but that approach comes with a number of limitations.

Scott Kellum has been doing interesting work in this area – what he calls “Intrinsic Typography” – applying animation/transition concepts like “easing” and “keyframes” to responsive type.

Proposal

Fantasai and I worked on a proposal to address & unify a number of related use-cases around interpolation & timelines:

Timelines can be defined in relation to:

Some timelines can be used to control animations (aka scroll-linked animations), but we also propose some form of interpolation function (currently called mix()) that can apply a timeline and easing function to a single propery.

There’s more to the proposal. Check it out:

https://wiki.csswg.org/ideas/timelines

Resources

From Scott:

CSSWG issues:

Notes

A few notes from my conversations with Scott:

Overlap with Scroll Animations

This reminds me of the proposed @scroll-timeline – and I see Scott had the same thought:

Split CSS event bindings from application

I think the syntax could use some finesse, but that direction feels right to me – building on current animation/transition syntax, to make it work with inputs other than “time” (like scrolling, or container-width).

I think there’s potential here for a shared @timeline at-rule that could be used for:

(I also think this can all be done without the selector() function, but I need to look into it more.)

Interpolation Function

The CSSWG resolved at one point to add an interpolation function – though the syntax/details are TBD.

That would require: