Re: [csswg-drafts] Interpolate values between breakpoints (#6245)

The CSS Working Group just discussed `Interpolate values between breakpoints`, and agreed to the following:

* `RESOLVED: Accept the general approach, change map naming to scale for now, iterate on syntax later`

<details><summary>The full IRC log of that discussion</summary>
&lt;bramus> TabAtkins: elika and i were looking over this and there is a generic request to interpolate values based on some othe rprogeress value<br>
&lt;bramus> … can be done by hand with calc, but does not work for all values<br>
&lt;bramus> … or there are complex ways to interpolate<br>
&lt;bramus> … seem slike a reasonable thing, that if you can do atransition, you can get the value for it too<br>
&lt;bramus> … upon review of the use-case, what we were tyring in the spec was not good enough<br>
&lt;bramus> … currently not implemented, so can start over<br>
&lt;bramus> … new proposal<br>
&lt;lea> q+<br>
&lt;bramus> … two notions of interpolation<br>
&lt;scribeAssistant> Writeup is at https://github.com/w3c/csswg-drafts/issues/6245#issuecomment-2661545284<br>
&lt;bramus> … 1. mixing of two values<br>
&lt;bramus> … 2. interpolate values in series, more like linear() for timing or gradients<br>
&lt;weinig> are the existing spec'd functions the progress() functions?<br>
&lt;bramus> … both are nearly identical, but when you reach 3 values they differ a lot<br>
&lt;bramus> … can model either with the other, but frustrating and weird<br>
&lt;bramus> … prop to introduce mix and map<br>
&lt;scribeAssistant> weinig: https://drafts.csswg.org/css-values-5/<br>
&lt;bramus> … mix = …<br>
&lt;bramus> … syntax proposal in the issue<br>
&lt;weinig> q+<br>
&lt;bramus> … thoughts, ideas, …?<br>
&lt;lea> https://github.com/w3c/csswg-drafts/issues/6245#issuecomment-2685663483<br>
&lt;Rossen3> ack lea<br>
&lt;bramus> lea: posted my thoughts on this link here<br>
&lt;bramus> … when i started writing  that i was not too crazy about introducing mor efunctions<br>
&lt;bramus> … wanted to overload the exsting mixing functions<br>
&lt;bramus> … but while writing my feedback it would make sens to have a new function (if it has a good name)<br>
&lt;bramus> … maps typically help you transform 1 value into another<br>
&lt;bramus> … (example)<br>
&lt;bramus> … several requests had to add mapping to css<br>
&lt;bramus> … even though sth like calc-map() or whater-map() it overloads the concept and now mapping is 2 diff things<br>
&lt;bramus> … also confusing to be using an established concept in a diffefernt way<br>
&lt;bramus> … interpolate is long and technical<br>
&lt;bramus> … brainstormed a bit (see table in comment)<br>
&lt;bramus> … leaning towards the name scale which gives a nice color-scale<br>
&lt;bramus> … and calc-scale<br>
&lt;bramus> … not ideal for images<br>
&lt;bramus> … also huge +1 for solving this use case<br>
&lt;bramus> … is major in design systems and tokens<br>
&lt;bramus> … so yeah<br>
&lt;bramus> TabAtkins: not attached to the name, we chose map bc interpolate was bad for your reasons and its also short like mix<br>
&lt;fantasai> +1<br>
&lt;bramus> … scale seems appropriate<br>
&lt;bramus> … having a hwole family of related fns the worry<br>
&lt;fantasai> We weren't particular about the name, just needed one.<br>
&lt;astearns> a little worried about our existing scale property<br>
&lt;Rossen3> ack weinig<br>
&lt;bramus> weinig: which of the css-values=5 fns is this replacing?<br>
&lt;bramus> TabAtkins: the mix functions, not the pgoress ones which are inputs to these<br>
&lt;bramus> weinig: got it<br>
&lt;bramus> … other suggestion: blend<br>
&lt;bramus> … bc that is often the result<br>
&lt;bramus> … proble with scale is that we already have scale()<br>
&lt;bramus> TabAtkins: only obj to blend is that it is a close synonym to mix<br>
&lt;lea> +1 to TabAtkins . Also `blend` sounds related to blend modes<br>
&lt;bramus> … the better we can help authors remember which is which is good<br>
&lt;bramus> lea: +1<br>
&lt;bramus> … and also bend sound related to blending modes<br>
&lt;bramus> TabAtkins: prolly cant avoid some semantic overlap<br>
&lt;bramus> Rossen3: sounds like we are converging?<br>
&lt;bramus> fantasai: yes, want to go over what it is<br>
&lt;lea> q+<br>
&lt;bramus> … the fn takes a bunch of top level params and what th eprogrsss is within the scale and a list of stops similar to linear-gradient(0 with an interpolation option between the stops (easing fn for example)<br>
&lt;bramus> … and then the top level options are a source for the progress, also giving you an option of transofmring that source thorugh an easing function, and an option saying each step gets its own easing<br>
&lt;bramus> … that is the top level<br>
&lt;bramus> … and then the stops have a syntax where it is `stop: value` and you interpolate between th stops<br>
&lt;fantasai> color: color-map(media-progress(width, 0px, 2000px),<br>
&lt;fantasai>                  0%: red,<br>
&lt;fantasai>                  100%: blue);<br>
&lt;fantasai> color: color-map(media(width),<br>
&lt;fantasai>                  0px: red,<br>
&lt;fantasai>                  2000px: blue);<br>
&lt;bramus> fantasai: also introducing new fns<br>
&lt;bramus> … percentages, pull the value out directly<br>
&lt;bramus> … pull out the start and end values, package them up together and put m in a variable<br>
&lt;bramus> … so the progress functions are worth keeping for that reason<br>
&lt;bramus> … Qs?<br>
&lt;Rossen3> ack lea<br>
&lt;bramus> lea: dont quite understand by vs each<br>
&lt;bramus> … its a good design goal to be compatible with gradients<br>
&lt;bramus> … it could even b ea design goal that everyting in side color-scale is a valid gradient<br>
&lt;bramus> … good for rease and debugging<br>
&lt;bramus> … the syntax with colons of positions adn values. not sure the reduction with the rest of CSS is warranted by the usability adv<br>
&lt;bramus> … seems small<br>
&lt;bramus> … breaking compat is a good thing if it gives you a significant advantage, not sure that is the case here<br>
&lt;bramus> … suggestion to stick to existing syntax<br>
&lt;bramus> … (missed: gradients)<br>
&lt;bramus> … where you can percentages<br>
&lt;TabAtkins> animating-timing-function vs animation-easing<br>
&lt;bramus> fantasai: diff between by and each is wehther you are applying easing between two stops or to the entiry of the progress value. Animations have this distinction. Can ease the entire timilne or in between keyframes.<br>
&lt;bramus> … have the ability to put easing between  any two stops, or the whole thing upfront<br>
&lt;lea> s/(missed: gradients)/we would need to make it mandatory that the stop position comes after the value in the calc version, as otherwise there would be disambiguation problems/<br>
&lt;bramus> … that is the difference<br>
&lt;bramus> … about the colon in the stop syntax: that is bc of the parsing ambiguity<br>
&lt;bramus> … cant know the reeturn value upfront<br>
&lt;bramus> … other optino is to align with if() and use semicolons<br>
&lt;bramus> … not sure though<br>
&lt;lea> q+ to ask about multiple positions, also use cases for each<br>
&lt;bramus> TabAtkins: there are certain value types make it ambigious to read or actually ambiguious<br>
&lt;bramus> … e.g. calcs() sometimes hard to read<br>
&lt;bramus> … not obvious to a human sometimes<br>
&lt;bramus> … more problematic is the generic map() that can do entire property values<br>
&lt;bramus> … no way to know where the value ends<br>
&lt;bramus> … so have to either put the percentages in a distinguished place (like now) or only require 1<br>
&lt;bramus> … would not allow us to do 1 or 2 stops<br>
&lt;bramus> … bc those fns have parsing difficulties if you try to mix things in, we decided to carry that through the whole family of functions<br>
&lt;bramus> … making most of map fns look similar to ?? but hten some not , looks worse<br>
&lt;Rossen3> ack lea<br>
&lt;Zakim> lea, you wanted to ask about multiple positions, also use cases for each<br>
&lt;TabAtkins> s/??/mix functions/<br>
&lt;bramus> lea: agree that constiency with eachother is more imporatnt than consistency with the rest of CSS<br>
&lt;TabAtkins> 1 + 2px +3px<br>
&lt;bramus> … not sure about the color … hard to read or disambiguation issue?<br>
&lt;bramus> … for the generic no amount of syntax would work other than putting it first<br>
&lt;bramus> fantasai: (missed) progress values. can have a stripe<br>
&lt;bramus> lea: is the generic fn actually ahppening? remember we had one for mix but then had to drop it<br>
&lt;bramus> TabAtkins: multiway interpolation is trickier but if its just for map you are only interpolating two values at a time – we already know how to do that<br>
&lt;bramus> lea: this wont solve issue with generic, but at least fo rothers we coul dintroduce an at-keyword<br>
&lt;bramus> … like red at 50%<br>
&lt;bramus> … very readable<br>
&lt;bramus> TabAtkins: but unfrotunately does not extend<br>
&lt;bramus> … not the best, happy to discuss precise syntax more<br>
&lt;bramus> … looking for objections about the general approach<br>
&lt;bramus> Rossen3: so now are gonna stick with the map?<br>
&lt;lea> fantasai: no, I meant `at 50%`<br>
&lt;lea> q?<br>
&lt;fantasai> @ 50% might be kinda nice though :)<br>
&lt;fantasai> It avoids any parsing issues since @ is not otherwise valid<br>
&lt;lea> can we have a proposed resolution?<br>
&lt;bramus> TabAtkins: lets switch over to scale and continue discussing<br>
&lt;bramus> lea: do we have a proposed resolution? take on work?<br>
&lt;bramus> TabAtkins: yes: accept the approach we have outlined in the issue changing the map naming for scale and continue iterating on the design in the spec<br>
&lt;lea> PROPOSED RESOLUTION: Accept the general approach, change map naming to scale for now, iterate on syntax later<br>
&lt;bramus> Rossen3: sounds reasonable<br>
&lt;bramus> weinig: will the keyframes part remain as well?<br>
&lt;bramus> TabAtkins: that is the plan, but also up for discussion<br>
&lt;bramus> weinig: I think you should keep them<br>
&lt;bramus> fantasai: Qs for syntax were about the separator keywords by vs each and the name of the function<br>
&lt;lea> Huge +1000 to solving this problem, this is huge. Some doubts about each (do we have use cases for it?) but we can sort out later<br>
&lt;bramus> lea: +1, like I said in IRC<br>
&lt;bramus> … its low level, but lack of being able to do this keeps cropping up all the time<br>
&lt;bramus> fantasai: yes, need to thank scott for filing this and following up on it<br>
&lt;bramus> Rossen3: Objections?<br>
&lt;bramus> … none, so we are resolved.<br>
&lt;bramus> RESOLVED: Accept the general approach, change map naming to scale for now, iterate on syntax later<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6245#issuecomment-2685746280 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 26 February 2025 17:33:57 UTC