Flip an svg along the x-axis so it's upside down - css

I am trying to flip this SVG that I found on here so that the whitespace is on the bottom and the wave is on the top, but I can't figure out how to go about it. Any suggestions?
body {
margin: 0;
}
footer {
position: absolute;
width: 100%;
height: 100px;
bottom: 0;
overflow: hidden;
}
<footer>
<svg viewBox="0 -20 700 110" width="100%" height="110" preserveAspectRatio="none">
<path transform="translate(0, -20)" d="M0,10 c80,-22 240,0 350,18 c90,17 260,7.5 350,-20 v50 h-700" fill="#CEB964" />
<path d="M0,10 c80,-18 230,-12 350,7 c80,13 260,17 350,-5 v100 h-700z" fill="#00273F" />
</svg>
</footer>

The simplest would possibly be to use a CSS transform to rotate by 180 degrees. Since the initial value for transform-origin is 50% 50% 0 the rotation happens around the center. This avoids the need to actually modify the SVG.
body {
margin: 0;
}
footer {
position: absolute;
width: 100%;
height: 100px;
bottom: 0;
overflow: hidden;
transform: rotate(180deg);
}
<footer>
<svg viewBox="0 -20 700 110" width="100%" height="110" preserveAspectRatio="none">
<path transform="translate(0, -20)" d="M0,10 c80,-22 240,0 350,18 c90,17 260,7.5 350,-20 v50 h-700" fill="#CEB964" />
<path d="M0,10 c80,-18 230,-12 350,7 c80,13 260,17 350,-5 v100 h-700z" fill="#00273F" />
</svg>
</footer>
Note that this doesn't actually "flip", but rotate. If flipping is more appropriate, scaleY with a value of -1 can be used as well. It scales along the transform-origin as well, so the above holds here as well.
body {
margin: 0;
}
footer {
position: absolute;
width: 100%;
height: 100px;
bottom: 0;
overflow: hidden;
transform: scaleY(-1);
}
<footer>
<svg viewBox="0 -20 700 110" width="100%" height="110" preserveAspectRatio="none">
<path transform="translate(0, -20)" d="M0,10 c80,-22 240,0 350,18 c90,17 260,7.5 350,-20 v50 h-700" fill="#CEB964" />
<path d="M0,10 c80,-18 230,-12 350,7 c80,13 260,17 350,-5 v100 h-700z" fill="#00273F" />
</svg>
</footer>

You may use scale transformation and adjust the viewbox like this:
body {
margin: 0;
}
footer {
position: absolute;
width: 100%;
height: 100px;
bottom: 0;
overflow: hidden;
}
<footer>
<svg viewBox="0 -70 700 110" width="100%" height="110" preserveAspectRatio="none">
<g transform="scale(1,-1)">
<path transform="translate(0, -20)" d="M0,10 c80,-22 240,0 350,18 c90,17 260,7.5 350,-20 v50 h-700" fill="#CEB964" />
<path d="M0,10 c80,-18 230,-12 350,7 c80,13 260,17 350,-5 v100 h-700z" fill="#00273F" />
</g>
</svg>
</footer>

Related

SVG ClipPath: Why does applying the clip path to a DIV have different results to an IMAGE?

I need to create a set of 3 triangles that each have content in them (images, copy, etc).
I have setup this Pen to show roughly what I'm trying to achieve: https://codepen.io/andystent/pen/OJyNdmB
And here is an image for quick reference:
In this example the "Top" and "Left" triangles are IMAGES with the clip-path applied and displaying perfectly.
The "Right" triangle (with the red background) is a DIV with the clip-path applied but the proportions are wrong.
It should look like a mirrored version of the "Left" triangle.
When I apply it to an image it is perfect but when I apply to the div it is not. What is the best way to do this?
I am new to SVG so it is extremely likely that I am not doing this correctly. I have looked at numerous posts and the method I have tried is from a few of those but without success... so now I'm reaching out to you geniuses...
Here's the HTML and CSS for the red "Right" triangle with the clip applied to the DIV in the CSS:
#right-wrapper {
position: absolute;
width: 50%;
height: 100%;
right: 0;
padding: 40px 20px;
box-sizing: border-box;
}
#right-content-div {
background-color: red;
height: 100%;
width: 100%;
position: absolute;
top: 0;
right: 0;
clip-path: url(#clip-path-right);
-webkit-clip-path: url(#clip-path-right);
display: flex;
justify-content: center;
align-items: center;
}
<div id="right-wrapper">
<svg width="100%" height="100%" viewBox="0 0 1220 1214" preserveAspectRatio="none">
<defs>
<clipPath id="clip-path-right">
<path d="M1232,1212.58943 L1232,4.82844551 C1232,3.17159126 1230.65685,1.82844551 1229,1.82844551 C1228.53907,1.82844551 1228.08435,1.93465364 1227.67111,2.13882722 L18.145562,599.743544 C13.1941115,602.189966 11.1633848,608.187127 13.6098071,613.138577 C14.582638,615.107544 16.1765951,616.701501 18.145562,617.674332 L1227.67111,1215.27905 C1229.15654,1216.01298 1230.95569,1215.40376 1231.68962,1213.91832 C1231.89379,1213.50508 1232,1213.05036 1232,1212.58943 Z" id="path-1">
</path>
</clipPath>
</defs>
<div id="right-content-div" preserveAspectRatio="none">
<h1>test heading</h1>
</div>
<!-- <image clip-path="url(#clip-path-right)" height="100%" width="100%" preserveAspectRatio="none" xlink:href="https://www.w3schools.com/css/klematis_big.jpg" /> -->
</svg>
</div>
----- UPDATE: -----
As suggested in the comments, I have created a simplified Pen that gets to the heart of what I'm trying to achieve and the embedded HTML and CSS is below.
Essentially I am trying to get the red <div> to be clipped exactly like the <image>.
https://codepen.io/andystent/pen/RwWRjLd
#right-content-div {
background-color: red;
height: 100%;
width: 100%;
position: absolute;
top: 0;
clip-path: url(#clip-path-right);
-webkit-clip-path: url(#clip-path-right);
}
<svg width="20%" height="20%" viewBox="0 0 1220 1214">
<defs>
<clipPath id="clip-path-right">
<path d="M1232,1212.58943 L1232,4.82844551 C1232,3.17159126 1230.65685,1.82844551 1229,1.82844551 C1228.53907,1.82844551 1228.08435,1.93465364 1227.67111,2.13882722 L18.145562,599.743544 C13.1941115,602.189966 11.1633848,608.187127 13.6098071,613.138577 C14.582638,615.107544 16.1765951,616.701501 18.145562,617.674332 L1227.67111,1215.27905 C1229.15654,1216.01298 1230.95569,1215.40376 1231.68962,1213.91832 C1231.89379,1213.50508 1232,1213.05036 1232,1212.58943 Z" id="path-1">
</path>
</clipPath>
</defs>
<image clip-path="url(#clip-path-right)" height="100%" width="100%" preserveAspectRatio="none" xlink:href="https://www.w3schools.com/css/klematis_big.jpg" />
</svg>
<div id="right-content-div" preserveAspectRatio="none">
<h1>test heading</h1>
</div>
Here is an idea where I will be using mask instead of clip-path. The main trick to correctly set the viewBox (you already have it in your code) add preserveAspectRatio="none" then have a mask size of 100% 100%
.box {
width:200px;
height:200px;
display:inline-block;
background:red;
}
.mask {
-webkit-mask:url('data:image/svg+xml;utf8,<svg preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1220 1214"> <path d="M1232,1212.58943 L1232,4.82844551 C1232,3.17159126 1230.65685,1.82844551 1229,1.82844551 C1228.53907,1.82844551 1228.08435,1.93465364 1227.67111,2.13882722 L18.145562,599.743544 C13.1941115,602.189966 11.1633848,608.187127 13.6098071,613.138577 C14.582638,615.107544 16.1765951,616.701501 18.145562,617.674332 L1227.67111,1215.27905 C1229.15654,1216.01298 1230.95569,1215.40376 1231.68962,1213.91832 C1231.89379,1213.50508 1232,1213.05036 1232,1212.58943 Z" /> </svg>') 0 0/100% 100%;
mask:url('data:image/svg+xml;utf8,<svg preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1220 1214"> <path d="M1232,1212.58943 L1232,4.82844551 C1232,3.17159126 1230.65685,1.82844551 1229,1.82844551 C1228.53907,1.82844551 1228.08435,1.93465364 1227.67111,2.13882722 L18.145562,599.743544 C13.1941115,602.189966 11.1633848,608.187127 13.6098071,613.138577 C14.582638,615.107544 16.1765951,616.701501 18.145562,617.674332 L1227.67111,1215.27905 C1229.15654,1216.01298 1230.95569,1215.40376 1231.68962,1213.91832 C1231.89379,1213.50508 1232,1213.05036 1232,1212.58943 Z" /> </svg>') 0 0/100% 100%;
}
<div class="box mask"></div>
<div class="box mask" style="width:300px;"></div>
<div class="box mask" style="height:300px;"></div>
<img src="https://i.picsum.photos/id/1074/200/200.jpg" class="mask">

Adding image to SVG path

I found some cool SVG code from and started trying things out. Now I cleared up most of the random code but now I want to add an image on the grey block, but cannot seem to get it to work. I tried a few tips from StackOverflow already like adding random classes to it and creating extra id's in the code but it still won't work. I would like to create something like this.
.slide {
position: relative;
padding: 8% 0;
}
.slide__image svg {
display: block;
width: 100%;
max-width: 560px;
margin: auto;
}
.slide__bg {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
}
<svg>
<g id="p">
<path opacity=".2" d="M0 2h252s-3.3 40.7-2.7 128.3C249 216 252 272 252 272s-88-2-124.3-
2C91.3 270 0 272 0 272V0z"/>
<path fill="#f4f3f1" d="M0 0h248v270H0z"/>
<path fill="#4f5150" d="M8 10h233v203H8z"/>
</g>
<g id="polaroid">
<use xlink:href="#p" transform="rotate(15)" x="175" y="50"/>
<use xlink:href="#p" transform="rotate(-5)" x="5" y="25"/>
</g>
</svg>
Thanks for looking at the question!

How do I make an image shrink to fit inside a fixed position flex box modal

How do I make an image shrink to fit inside a fixed position flex box modal?
When trying the below the image overlaps the header/footer. It needs to work for images both tall, or wide, and in IE.
.modal-dialog {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.modal-content {
display: flex;
flex-direction: column;
height: 100%;
}
.modal-header {
background: red;
margin: 20px;
}
.modal-body {
background: green;
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 0 20px;
}
.modal-footer {
background: blue;
margin: 20px;
}
<div class="modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
header
</div>
<div class="modal-body">
<img src="https://via.placeholder.com/900x1200" />
</div>
<div class="modal-footer">
footer
</div>
</div>
</div>
</div>
Note this is a simple example, and I am really using a complicated SVG, not an image tag, so I can't use a background image.
You can use good old position: absolute with max-width and max-height:
/* for demonstration I have replaced all irrelavant styles with this */
.modal-body {
width: 80vw;
height: 60vh;
margin: 10% auto 0;
background: green;
}
/* parent must be positioned */
.modal-body {
position: relative;
}
/* size and center */
.modal-body img {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
max-width: 100%;
max-height: 100%;
margin: auto;
}
<div class="modal-body">
<img src="https://via.placeholder.com/900x1200" />
</div>
Just a reminder but by default images try to maintain their aspect ratios, so simply setting a percentage width will allow an inlined image to grow to the proper height OR setting only the height to a percentage will maintain the width.
The key is to only set ONE dimension and let the browser figure out the rest.
This is especially true if you set the sizes Inline using the appropriate HTML structure.
<div class="modal-body">
<img src="https://via.placeholder.com/900x1200" width="100%" />
</div>
Now you just set the max-width of the container with CSS and everything is happy. That should be true of any use of the img tag. Meaning if you use an SVG in the img src attribute you'll get it to function like an image. That said, I believe you lose SVG interactions if you do it that way.
So assuming you're going to actually drop the SVG into your code, you need to do a bit of work to the SVG.
Note how most SVG's have hard-coded heights and widths in the header Simply removing the hard-coded height/width "should" make the SVG scale correctly since the view-box keeps the proportions of the image.
<svg width="299px" height="138px" viewBox="0 0 299 138" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="example">
<rect id="Rectangle" fill="#D8D8D8" x="0" y="0" width="299" height="138"></rect>
<circle id="Oval" fill="#46BEC6" cx="53" cy="50" r="26"></circle>
<circle id="Oval-Copy" fill="#46BEC6" cx="105" cy="76" r="26"></circle>
<circle id="Oval-Copy-2" fill="#46BEC6" cx="165" cy="95" r="26"></circle>
<circle id="Oval-Copy-3" fill="#46BEC6" cx="217" cy="63" r="26"></circle>
<circle id="Oval-Copy-4" fill="#46BEC6" cx="269" cy="32" r="26"></circle>
</g>
</g>
</svg>
<svg viewBox="0 0 299 138" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="example">
<rect id="Rectangle" fill="#D8D8D8" x="0" y="0" width="299" height="138"></rect>
<circle id="Oval" fill="#46BEC6" cx="53" cy="50" r="26"></circle>
<circle id="Oval-Copy" fill="#46BEC6" cx="105" cy="76" r="26"></circle>
<circle id="Oval-Copy-2" fill="#46BEC6" cx="165" cy="95" r="26"></circle>
<circle id="Oval-Copy-3" fill="#46BEC6" cx="217" cy="63" r="26"></circle>
<circle id="Oval-Copy-4" fill="#46BEC6" cx="269" cy="32" r="26"></circle>
</g>
</g>
</svg>
If you don't know which one needs to be set (like in the case of a dynamic image) you'll need to measure it with javascript before applying the correct measurement. Something along these lines:
fixImage(){
var img = findTheImageInTheDom;
if (img.width > img.height){
img.width = "100%";
} else {
img.height = "100%";
}

Possible to remove the rectangular shadow from a curve image?

I have created a svg shape. I need to remove the rectangular shadow. Is it possible to keep the shape without the rectangular shadow. You see the shadow by inspect this element. Here below the screenshot that I need your help.
* {
padding: 0;
margin: 0;
}
html,
body {
height: 100%;
width: 100%;
background: #0097d1;
}
.inner-bg {
width: 225px;
height: 252px;
position: relative;
left: 150px;
}
.inner-bg2 {
height: 413px;
width: 354px;
}
.photo_rectangle_inverse {
width: 100%;
height: 100%;
-webkit-clip-path: url(#shape);
clip-path: url(#shape);
position: relative;
-webkit-transform: translateZ(1px)
}
.hover-bg {
opacity: 0;
transition: opacity .5s ease;
}
.inner-bg:hover .hover-bg,
.inner-bg2:hover .hover-bg {
opacity: 1;
}
<svg width="0" height="0">
<defs>
<clipPath id="shape">
<path d="M1397.715,175.794c-25.751-15.171-69.059-38.065-129.139-60.976c-67.575-25.768-142.155-46.303-221.671-61.035 C947.395,35.348,839.829,26,727.195,26C262.767,26,66.548,171.319,29.886,202.439c-2.296,27.868-7.736,113.978,0.68,229.038 C36.582,513.729,48.399,594.485,65.69,671.5c21.543,95.959,51.69,186.337,89.604,268.625 c34.129,74.072,64.323,133.951,95.024,188.442c36.672,65.09,75.123,124.286,117.55,180.97 c47.205,63.067,99.354,123.173,159.428,183.753c60.364,60.873,127.474,120.997,204.717,183.385
c76.575-61.797,143.891-122.42,205.319-184.881c60.193-61.205,112.963-122.409,161.323-187.11
c42.74-57.182,81.631-116.64,118.893-181.771c30.475-53.269,60.348-111.148,94.01-182.15
c39.049-82.368,69.602-173.132,90.807-269.769c17.023-77.58,28.095-159.092,32.906-242.272
c6.667-115.242-0.692-202.073-3.775-231.25C1424.622,192.59,1413.379,185.023,1397.715,175.794z" />
</clipPath>
</defs>
</svg>
<svg class="inner-bg" viewBox="0 0 1464 1710">
<g>
<path fill="#FFFFFF" d="M1401.85,170.106c-25.92-15.308-69.51-38.408-129.982-61.524c-68.004-25.994-143.056-46.708-223.071-61.567
C948.692,28.426,840.49,19,727.195,19c-119.749,0-231.57,9.722-332.358,28.895c-80.505,15.314-154.182,36.658-218.984,63.438
c-57.568,23.79-97.325,47.554-120.54,63.301c-16.03,10.873-26.588,19.521-32.163,24.386c-2.144,24.728-8.309,113.118,0.409,232.628
c6.028,82.638,17.889,163.781,35.253,241.177c21.654,96.517,51.976,187.435,90.123,270.228
c34.21,74.249,64.487,134.289,95.284,188.949c36.822,65.356,75.435,124.801,118.044,181.729
c47.401,63.329,99.757,123.675,160.061,184.487c61.688,62.207,130.392,123.63,209.686,187.446
c78.608-63.193,147.521-125.116,210.313-188.963c60.417-61.433,113.388-122.871,161.939-187.827
c42.913-57.413,81.956-117.104,119.361-182.485c30.566-53.428,60.518-111.46,94.259-182.629
c39.306-82.907,70.045-174.247,91.366-271.482c17.1-77.986,28.213-159.913,33.03-243.505c6.913-119.938-1.295-209.211-4.161-235.164
C1431.553,188.84,1419.487,180.523,1401.85,170.106z" />
</g>
<image xlink:href='http://lorempixel.com/225/262' class='photo_rectangle_inverse' width="1464px" height="1710px" />
<path class="hover-bg" fill="#0097d1" fill-opacity=".6" d="M1401.85,170.106c-25.92-15.308-69.51-38.408-129.982-61.524c-68.004-25.994-143.056-46.708-223.071-61.567
C948.692,28.426,840.49,19,727.195,19c-119.749,0-231.57,9.722-332.358,28.895c-80.505,15.314-154.182,36.658-218.984,63.438
c-57.568,23.79-97.325,47.554-120.54,63.301c-16.03,10.873-26.588,19.521-32.163,24.386c-2.144,24.728-8.309,113.118,0.409,232.628
c6.028,82.638,17.889,163.781,35.253,241.177c21.654,96.517,51.976,187.435,90.123,270.228
c34.21,74.249,64.487,134.289,95.284,188.949c36.822,65.356,75.435,124.801,118.044,181.729
c47.401,63.329,99.757,123.675,160.061,184.487c61.688,62.207,130.392,123.63,209.686,187.446
c78.608-63.193,147.521-125.116,210.313-188.963c60.417-61.433,113.388-122.871,161.939-187.827
c42.913-57.413,81.956-117.104,119.361-182.485c30.566-53.428,60.518-111.46,94.259-182.629
c39.306-82.907,70.045-174.247,91.366-271.482c17.1-77.986,28.213-159.913,33.03-243.505c6.913-119.938-1.295-209.211-4.161-235.164
C1431.553,188.84,1419.487,180.523,1401.85,170.106z" />
</svg>
<svg class="inner-bg2" viewBox="0 0 1464 1710">
<g>
<path fill="#FFFFFF" d="M1401.85,170.106c-25.92-15.308-69.51-38.408-129.982-61.524c-68.004-25.994-143.056-46.708-223.071-61.567
C948.692,28.426,840.49,19,727.195,19c-119.749,0-231.57,9.722-332.358,28.895c-80.505,15.314-154.182,36.658-218.984,63.438
c-57.568,23.79-97.325,47.554-120.54,63.301c-16.03,10.873-26.588,19.521-32.163,24.386c-2.144,24.728-8.309,113.118,0.409,232.628
c6.028,82.638,17.889,163.781,35.253,241.177c21.654,96.517,51.976,187.435,90.123,270.228
c34.21,74.249,64.487,134.289,95.284,188.949c36.822,65.356,75.435,124.801,118.044,181.729
c47.401,63.329,99.757,123.675,160.061,184.487c61.688,62.207,130.392,123.63,209.686,187.446
c78.608-63.193,147.521-125.116,210.313-188.963c60.417-61.433,113.388-122.871,161.939-187.827
c42.913-57.413,81.956-117.104,119.361-182.485c30.566-53.428,60.518-111.46,94.259-182.629
c39.306-82.907,70.045-174.247,91.366-271.482c17.1-77.986,28.213-159.913,33.03-243.505c6.913-119.938-1.295-209.211-4.161-235.164
C1431.553,188.84,1419.487,180.523,1401.85,170.106z" />
</g>
<image xlink:href='http://lorempixel.com/1464/1710' class='photo_rectangle_inverse' width="1464px" height="1710px" />
<path class="hover-bg" fill="#0097d1" fill-opacity=".6" d="M1401.85,170.106c-25.92-15.308-69.51-38.408-129.982-61.524c-68.004-25.994-143.056-46.708-223.071-61.567
C948.692,28.426,840.49,19,727.195,19c-119.749,0-231.57,9.722-332.358,28.895c-80.505,15.314-154.182,36.658-218.984,63.438
c-57.568,23.79-97.325,47.554-120.54,63.301c-16.03,10.873-26.588,19.521-32.163,24.386c-2.144,24.728-8.309,113.118,0.409,232.628
c6.028,82.638,17.889,163.781,35.253,241.177c21.654,96.517,51.976,187.435,90.123,270.228
c34.21,74.249,64.487,134.289,95.284,188.949c36.822,65.356,75.435,124.801,118.044,181.729
c47.401,63.329,99.757,123.675,160.061,184.487c61.688,62.207,130.392,123.63,209.686,187.446
c78.608-63.193,147.521-125.116,210.313-188.963c60.417-61.433,113.388-122.871,161.939-187.827
c42.913-57.413,81.956-117.104,119.361-182.485c30.566-53.428,60.518-111.46,94.259-182.629
c39.306-82.907,70.045-174.247,91.366-271.482c17.1-77.986,28.213-159.913,33.03-243.505c6.913-119.938-1.295-209.211-4.161-235.164
C1431.553,188.84,1419.487,180.523,1401.85,170.106z" />
</svg>
Please check also the jsfiddle

Creating a believable elliptical orbiting element (plane) with SVG and CSS?

first time question poster here. After over 2 days of searching on StackOverflow & other sites, and playing on my own with CodePen, I just cannot seem to figure out how to create an orbiting path for an SVG element that isn't a circle.
Here's a copy of the closest thing I've come up with: http://codepen.io/Whatsit2yaa/pen/epbbRR?editors=100
And the code -
HTML:
<svg width="600" height="500" viewbox="0 0 600 500">
<path id="flight-path" fill="none" stroke="#CCC" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="10" d="M592.7,308.1c-28.5,108.8-183,162.6-344.9,120.2C85.8,385.8-22.4,263.2,6.1,154.3
C34.6,45.5,189.1-8.3,351.1,34.2C513,76.6,621.2,199.3,592.7,308.1z"/>
<g id="plane" transform="translate(-199.4, -413.2)" scale="0.8">
<path d="M199.4,413.2L199.4,413.2c0.3,5.4,10.9,8.9,10.9,8.9l29.9,7.5l13.5,41.2l12.1,3.3l-6.6-37.8l24.6,6.8l3.9,6.2
l8,3.5l-4-14.1l10.7-10l-8.6-1.1l-6.5,3.3l-24.6-6.8l25.1-29l-12.1-3.3l-32.8,28.4l-29.7-9C213.1,411.1,202.4,408.7,199.4,413.2z" fill="#333"/>
</g>
<animateMotion
xlink:href="#plane"
dur="3s"
begin="0s"
fill="freeze"
repeatCount="indefinite"
rotate="auto-reverse"
>
<mpath xlink:href="#flight-path" />
</animateMotion>
</svg>
CSS:
html, body {
height: 100%;
}
body {
background: -webkit-linear-gradient(#FFF, #3276b1); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(#FFF, #3276b1); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(#FFF, #3276b1); /* For Firefox 3.6 to 15 */
background: linear-gradient(#FFF, #3276b1);
}
svg {
position: fixed;
overflow: visible;
top: 20%;
height: 60%;
left: 20%;
width: 60%;
}
Here's a pen showing what I'm trying to achieve:
http://codepen.io/guerreiro/pen/obhzc
And the code -
HTML:
<svg viewBox="0 0 160 160" width="160" height="160">
<circle cx="80" cy="80" r="50" />
<g transform=" matrix(0.866, -0.5, 0.25, 0.433, 80, 80)">
<path d="M 0,70 A 65,70 0 0,0 65,0 5,5 0 0,1 75,0 75,70 0 0,1 0,70Z" fill="#FFF">
<animateTransform attributeName="transform" type="rotate" from="360 0 0" to="0 0 0" dur="1s" repeatCount="indefinite" />
</path>
</g>
<path d="M 50,0 A 50,50 0 0,0 -50,0Z" transform="matrix(0.866, -0.5, 0.5, 0.866, 80, 80)" />
</svg>
CSS:
* {
margin: 0;
padding: 0;
}
html, body {
height: 100%;
}
body {
background: #FC0;
}
svg {
position: fixed;
top: 20%;
height: 60%;
left: 20%;
width: 60%;
}
I can't seem to get an SVG that isn't round to properly adjust & transform as it circles a planet in an ellipse that goes around an orbit.
I'm open to using SVG images with CSS transform if this is beyond SMIL capabilities. Any animators have advice/help for me? Thanks so much!

Resources