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

I did play a bit with the current prototype implementation in Canary, and stumbled upon an issue: https://bugs.chromium.org/p/chromium/issues/detail?id=1503730#c6

It seems, that the current formula in the spec () does contradict the intended purpose of the function:

> The value returned by a valid [progress()](https://drafts.csswg.org/css-values-5/#funcdef-progress) notation is progress value / (end value - start value),

vs

> returns a [<number>](https://drafts.csswg.org/css-values-4/#number-value) value representing the position of one [calculation](https://drafts.csswg.org/css-values-4/#calc-calculation) (the [progress value](https://drafts.csswg.org/css-values-5/#progress-value)) between two other calculations (the [progress start value](https://drafts.csswg.org/css-values-5/#progress-start-value) and [progress end value](https://drafts.csswg.org/css-values-5/#progress-end-value)).

With my example being `progress(75px from 50px to 100px)` — we want to know where the 75px lies between 100px and 50px. Per current formula it ends up being `75 / (100 - 50)` === `1.5`, but, I think, the intended formula was:

> (progress value - start value) / (end value - start value)

Which, for the given values, will be `(75 - 50) / (100 - 50)` === '0.5', which will mean that 75px is half-way between 50px and 100px.

So, I think, the spec should be updated?

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


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

Received on Monday, 11 December 2023 15:22:25 UTC