Re: [csswg-drafts] [css-images-4] Do color interpolation hints take up a slot? (#3931)

A couple of other observations from the field:

__1. Boundary cases for logarithm function:__

I've made a [quick notebook](https://observablehq.com/@danburzo/css-gradient-interpolation-hints) to explore how the interpolation hint's position affects the interpolation curve. For `H = 0` and `H = 1` the logarithm gives (understandably) weird results and there might need to be some adjustments to the formula. This seems to work as expected:

```js
const C = (P, H) => 
  H === 0 ? 1 : 
  H === 1 ? 0 : 
  Math.pow(P, Math.log(0.5) / Math.log(H));
```

i.e. for `H = 0`, paint completely with next color stop, and for `H = 1` paint completely with previous color stop. (Also note that Photoshop limits H to the [0.05, 0.95] range to avoid the extreme curves)

__ 2. Interpolation hint fixup example__

The example below seems to suggest that there's a step 4 (possibly computation of midpoint color?), and suggests the midpoint is split into two linear gradients, which I don't think is the case anymore. (I'm also curious if that was the case in a previous iteration of the spec.)

```
8. linear-gradient(red, 25%, white)
   =14=>
   linear-gradient(red 0%, rgb(100%,50%,50%) 25%, white 100%) 
```

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

Received on Wednesday, 15 May 2019 07:55:33 UTC