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.










share|improve this question


























    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.










    share|improve this question
























      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.










      share|improve this question













      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 18 at 13:42









      iblue

      19.1k1470118




      19.1k1470118
























          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>








          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            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

























            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>








            share|improve this answer

























              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>








              share|improve this answer























                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>








                share|improve this answer












                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>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 18 at 18:38









                ccprog

                8,3041825




                8,3041825






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Paul Cézanne

                    UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

                    Angular material date-picker (MatDatepicker) auto completes the date on focus out