W3C home > Mailing lists > Public > www-style@w3.org > August 2013

Re: [css-images] color-stop position interpolation

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 19 Aug 2013 14:15:09 -0700
Message-ID: <CAAWBYDBWA6O-mbhMfoOq8hUZ26P5LoGX+S8snyT+5ytxyWR+VA@mail.gmail.com>
To: Simon Sapin <simon.sapin@exyr.org>
Cc: www-style list <www-style@w3.org>
On Mon, Aug 19, 2013 at 11:59 AM, Simon Sapin <simon.sapin@exyr.org> wrote:
> FWIW, the distance from the center to a percentage stop position in a linear
> gradient is proportional to:
>
>   abs(width * sin(angle)) + abs(height * cos(angle))
>
> Which looks like this when changing the angle with a fixed percentage
> position:
>
> https://www.wolframalpha.com/input/?i=polar+plot+abs%284*cos%28a%29%29+%2B+abs%283*sin%28a%29%29%2C+a+%3D+0+to+2*pi
>
> I agree that animations might look better when interpolating absolute
> lengths rather than following the above.

Hah, cool graph.  To be specific, the graph represents the positions
of the 0%/100% color-stops in a 4:3 ratio box as you rotate - just
draw a line through the origin at a given angle, and where it
intercepts that curve are the stop locations.

~TJ
Received on Monday, 19 August 2013 21:15:56 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:31 UTC