W3C home > Mailing lists > Public > www-svg@w3.org > February 2014

Re: Conical gradients

From: Jasper van de Gronde <th.v.d.gronde@hccnet.nl>
Date: Tue, 18 Feb 2014 20:27:39 +0100
Message-ID: <5303B42B.5050506@hccnet.nl>
To: www-svg@w3.org
On 2014-01-25 02:03, Alan Gresley wrote:
> I can't see how combining both a radial and conic gradient would allow 
> for a kind of spiral gradient. A spiral gradient is more like a 
> repeating radial gradient. What you don't cover is something like a 
> turbine [3] which is a repeating conic gradient. 
I figured it made more sense to just code it up than to keep talking 
past each other. What I meant is now implemented in javascript, and 
available here:
http://home.hccnet.nl/th.v.d.gronde/dev/misc/
The left image essentially shows the gradient when viewed as a function 
of radius and angle (horizontal axis and vertical axis), while the right 
image shows what the actual gradient would look like when filling a 
square. (I didn't bother coding up support for different 
horizontal/vertical radii, nor for allowing the "focus" and "center" to 
be different, but it would be perfectly possible to add such 
functionality as well.)

To get a repeating conical gradient, just enter some (integer) number of 
arms larger than 1, with Infinity for the radius.

Note that of course the exact parameters required could be fleshed out 
some more, and perhaps there are better ways to expose this 
functionality, but if at some point both radial and conical gradients 
would be allowed, I still think it would be a shame not to allow the 
full spectrum of "polar gradients".

And just to clarify: it might feel a little strange to enter "Infinity" 
as a radius, but it doesn't give any problems (basically some stuff gets 
divided by infinity, which is perfectly fine), and simply yields the 
limit case of what happens when the radius goes to infinity (which 
happens to give a conical gradient if you specify that you want 1 or 
more arms). But if desired other schemes are also possible, like having 
a radius and a "period" similar to the number of arms (mathematically 
it's the same idea).
Received on Tuesday, 18 February 2014 19:28:12 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:35 UTC