Reverse radial gradient
up vote
0
down vote
favorite
I am trying to minify a SVG by hand. It uses two radial gradients which are the same, but with colors reversed.
<radialGradient id="a">
<stop offset="0" stop-color="#aadee8"/>
<stop offset=".2" stop-color="#94d7e7"/>
<stop offset=".5" stop-color="#6dcce9"/>
<stop offset=".8" stop-color="#28b1e6"/>
<stop offset="1" stop-color="#27ace2"/>
</radialGradient>
<!-- Same colors, but opposite direction as #a -->
<radialGradient id="b">
<stop offset="0" stop-color="#27ace2"/>
<stop offset=".2" stop-color="#28b1e6"/>
<stop offset=".5" stop-color="#6dcce9"/>
<stop offset=".8" stop-color="#94d7e7"/>
<stop offset="1" stop-color="#aadee8"/>
</radialGradient>
Is it possible to create an inverse copy by cloning a? I already tried <radialGradient xlink:href="#a" gradientTransform="scale(-1)" />, but that did not work out.
svg
add a comment |
up vote
0
down vote
favorite
I am trying to minify a SVG by hand. It uses two radial gradients which are the same, but with colors reversed.
<radialGradient id="a">
<stop offset="0" stop-color="#aadee8"/>
<stop offset=".2" stop-color="#94d7e7"/>
<stop offset=".5" stop-color="#6dcce9"/>
<stop offset=".8" stop-color="#28b1e6"/>
<stop offset="1" stop-color="#27ace2"/>
</radialGradient>
<!-- Same colors, but opposite direction as #a -->
<radialGradient id="b">
<stop offset="0" stop-color="#27ace2"/>
<stop offset=".2" stop-color="#28b1e6"/>
<stop offset=".5" stop-color="#6dcce9"/>
<stop offset=".8" stop-color="#94d7e7"/>
<stop offset="1" stop-color="#aadee8"/>
</radialGradient>
Is it possible to create an inverse copy by cloning a? I already tried <radialGradient xlink:href="#a" gradientTransform="scale(-1)" />, but that did not work out.
svg
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to minify a SVG by hand. It uses two radial gradients which are the same, but with colors reversed.
<radialGradient id="a">
<stop offset="0" stop-color="#aadee8"/>
<stop offset=".2" stop-color="#94d7e7"/>
<stop offset=".5" stop-color="#6dcce9"/>
<stop offset=".8" stop-color="#28b1e6"/>
<stop offset="1" stop-color="#27ace2"/>
</radialGradient>
<!-- Same colors, but opposite direction as #a -->
<radialGradient id="b">
<stop offset="0" stop-color="#27ace2"/>
<stop offset=".2" stop-color="#28b1e6"/>
<stop offset=".5" stop-color="#6dcce9"/>
<stop offset=".8" stop-color="#94d7e7"/>
<stop offset="1" stop-color="#aadee8"/>
</radialGradient>
Is it possible to create an inverse copy by cloning a? I already tried <radialGradient xlink:href="#a" gradientTransform="scale(-1)" />, but that did not work out.
svg
I am trying to minify a SVG by hand. It uses two radial gradients which are the same, but with colors reversed.
<radialGradient id="a">
<stop offset="0" stop-color="#aadee8"/>
<stop offset=".2" stop-color="#94d7e7"/>
<stop offset=".5" stop-color="#6dcce9"/>
<stop offset=".8" stop-color="#28b1e6"/>
<stop offset="1" stop-color="#27ace2"/>
</radialGradient>
<!-- Same colors, but opposite direction as #a -->
<radialGradient id="b">
<stop offset="0" stop-color="#27ace2"/>
<stop offset=".2" stop-color="#28b1e6"/>
<stop offset=".5" stop-color="#6dcce9"/>
<stop offset=".8" stop-color="#94d7e7"/>
<stop offset="1" stop-color="#aadee8"/>
</radialGradient>
Is it possible to create an inverse copy by cloning a? I already tried <radialGradient xlink:href="#a" gradientTransform="scale(-1)" />, but that did not work out.
svg
svg
asked Nov 18 at 13:42
iblue
19.1k1470118
19.1k1470118
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
5
down vote
Here's a bit of trickery with the spreadMethod; it depends on the use of the fr attribute which was only introduced in SVG 2, so compatibility might be an issue.
The idea is to define the colors outside the intended outer radius and then define how it is continued further in. (Percentages are relative to the bounding box, so r="50%", the default, fits the outer radius to the border of the box if cx is in the middle.)
<svg width="200" height="100">
<radialGradient id="a" r="100%" fr="50%">
<stop offset="0" stop-color="#aadee8"/>
<stop offset=".2" stop-color="#94d7e7"/>
<stop offset=".5" stop-color="#6dcce9"/>
<stop offset=".8" stop-color="#28b1e6"/>
<stop offset="1" stop-color="#27ace2"/>
</radialGradient>
<radialGradient id="b" spreadMethod="repeat" xlink:href="#a" />
<radialGradient id="c" spreadMethod="reflect" xlink:href="#a" />
<circle r="50" cx="50" cy="50" fill="url(#b)" />
<circle r="50" cx="150" cy="50" fill="url(#c)" />
</svg>add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
Here's a bit of trickery with the spreadMethod; it depends on the use of the fr attribute which was only introduced in SVG 2, so compatibility might be an issue.
The idea is to define the colors outside the intended outer radius and then define how it is continued further in. (Percentages are relative to the bounding box, so r="50%", the default, fits the outer radius to the border of the box if cx is in the middle.)
<svg width="200" height="100">
<radialGradient id="a" r="100%" fr="50%">
<stop offset="0" stop-color="#aadee8"/>
<stop offset=".2" stop-color="#94d7e7"/>
<stop offset=".5" stop-color="#6dcce9"/>
<stop offset=".8" stop-color="#28b1e6"/>
<stop offset="1" stop-color="#27ace2"/>
</radialGradient>
<radialGradient id="b" spreadMethod="repeat" xlink:href="#a" />
<radialGradient id="c" spreadMethod="reflect" xlink:href="#a" />
<circle r="50" cx="50" cy="50" fill="url(#b)" />
<circle r="50" cx="150" cy="50" fill="url(#c)" />
</svg>add a comment |
up vote
5
down vote
Here's a bit of trickery with the spreadMethod; it depends on the use of the fr attribute which was only introduced in SVG 2, so compatibility might be an issue.
The idea is to define the colors outside the intended outer radius and then define how it is continued further in. (Percentages are relative to the bounding box, so r="50%", the default, fits the outer radius to the border of the box if cx is in the middle.)
<svg width="200" height="100">
<radialGradient id="a" r="100%" fr="50%">
<stop offset="0" stop-color="#aadee8"/>
<stop offset=".2" stop-color="#94d7e7"/>
<stop offset=".5" stop-color="#6dcce9"/>
<stop offset=".8" stop-color="#28b1e6"/>
<stop offset="1" stop-color="#27ace2"/>
</radialGradient>
<radialGradient id="b" spreadMethod="repeat" xlink:href="#a" />
<radialGradient id="c" spreadMethod="reflect" xlink:href="#a" />
<circle r="50" cx="50" cy="50" fill="url(#b)" />
<circle r="50" cx="150" cy="50" fill="url(#c)" />
</svg>add a comment |
up vote
5
down vote
up vote
5
down vote
Here's a bit of trickery with the spreadMethod; it depends on the use of the fr attribute which was only introduced in SVG 2, so compatibility might be an issue.
The idea is to define the colors outside the intended outer radius and then define how it is continued further in. (Percentages are relative to the bounding box, so r="50%", the default, fits the outer radius to the border of the box if cx is in the middle.)
<svg width="200" height="100">
<radialGradient id="a" r="100%" fr="50%">
<stop offset="0" stop-color="#aadee8"/>
<stop offset=".2" stop-color="#94d7e7"/>
<stop offset=".5" stop-color="#6dcce9"/>
<stop offset=".8" stop-color="#28b1e6"/>
<stop offset="1" stop-color="#27ace2"/>
</radialGradient>
<radialGradient id="b" spreadMethod="repeat" xlink:href="#a" />
<radialGradient id="c" spreadMethod="reflect" xlink:href="#a" />
<circle r="50" cx="50" cy="50" fill="url(#b)" />
<circle r="50" cx="150" cy="50" fill="url(#c)" />
</svg>Here's a bit of trickery with the spreadMethod; it depends on the use of the fr attribute which was only introduced in SVG 2, so compatibility might be an issue.
The idea is to define the colors outside the intended outer radius and then define how it is continued further in. (Percentages are relative to the bounding box, so r="50%", the default, fits the outer radius to the border of the box if cx is in the middle.)
<svg width="200" height="100">
<radialGradient id="a" r="100%" fr="50%">
<stop offset="0" stop-color="#aadee8"/>
<stop offset=".2" stop-color="#94d7e7"/>
<stop offset=".5" stop-color="#6dcce9"/>
<stop offset=".8" stop-color="#28b1e6"/>
<stop offset="1" stop-color="#27ace2"/>
</radialGradient>
<radialGradient id="b" spreadMethod="repeat" xlink:href="#a" />
<radialGradient id="c" spreadMethod="reflect" xlink:href="#a" />
<circle r="50" cx="50" cy="50" fill="url(#b)" />
<circle r="50" cx="150" cy="50" fill="url(#c)" />
</svg><svg width="200" height="100">
<radialGradient id="a" r="100%" fr="50%">
<stop offset="0" stop-color="#aadee8"/>
<stop offset=".2" stop-color="#94d7e7"/>
<stop offset=".5" stop-color="#6dcce9"/>
<stop offset=".8" stop-color="#28b1e6"/>
<stop offset="1" stop-color="#27ace2"/>
</radialGradient>
<radialGradient id="b" spreadMethod="repeat" xlink:href="#a" />
<radialGradient id="c" spreadMethod="reflect" xlink:href="#a" />
<circle r="50" cx="50" cy="50" fill="url(#b)" />
<circle r="50" cx="150" cy="50" fill="url(#c)" />
</svg><svg width="200" height="100">
<radialGradient id="a" r="100%" fr="50%">
<stop offset="0" stop-color="#aadee8"/>
<stop offset=".2" stop-color="#94d7e7"/>
<stop offset=".5" stop-color="#6dcce9"/>
<stop offset=".8" stop-color="#28b1e6"/>
<stop offset="1" stop-color="#27ace2"/>
</radialGradient>
<radialGradient id="b" spreadMethod="repeat" xlink:href="#a" />
<radialGradient id="c" spreadMethod="reflect" xlink:href="#a" />
<circle r="50" cx="50" cy="50" fill="url(#b)" />
<circle r="50" cx="150" cy="50" fill="url(#c)" />
</svg>answered Nov 18 at 18:38
ccprog
8,3041825
8,3041825
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53361531%2freverse-radial-gradient%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown