Creating a believable elliptical orbiting element (plane) with SVG and CSS? - 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!

Related

CSS background-image .SVG not animating on IOS

I have the following CSS class:
&.loading {
background: url(/svg/loading_animated/fff.svg) $actionColor no-repeat center;
}
This loads this SVG image:
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background: none; display: block;" width="200" height="200" viewBox="0 0 100 100">
<circle cx="50" cy="50" fill="none" stroke="#fff" stroke-width="15" r="41" stroke-dasharray="193 66">
<animateTransform attributeName="transform" attributeType="XML" type="rotate" from="0 50 50" to="360 50 50" dur="1.1s" repeatCount="indefinite"></animateTransform>
</circle>
</svg>
This works fine on desktop, but on iPhone/IOS, the animation does not work. When I navigate straight to the SVG, I do see the animation.
When I embed the SVG into my CSS class, it also animates:
background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' style='margin: auto; background: none; display: block;' width='200' height='200' viewBox='0 0 100 100'> <circle cx='50' cy='50' fill='none' stroke='white' stroke-width='15' r='41' stroke-dasharray='193 66'><animateTransform attributeName='transform' attributeType='XML' type='rotate' from='0 50 50' to='360 50 50' dur='1.1s' repeatCount='indefinite'></animateTransform></circle></svg>") $actionColor no-repeat center;
That seems to be the solution, but I'd rather have it work with the URL (this fits my code better).
Is there a way to keep the SVG animated on iOS, while using it as a background-image?

SVG mask or CSS style to knock out center of svg so its transparent

I have an SVG that is essentially a box with rounded edges and borders on the corners of each edge:
<div class="container">
</div>
<svg width="258" height="258" viewBox="0 0 258 258" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M257 211.489L257 245C257 251.627 251.627 257 245 257L211.489 257" stroke="white" stroke-width="2" />
<path d="M211.489 0.999998L245 0.999999C251.627 1 257 6.37258 257 13L257 46.5111" stroke="white" stroke-width="2" />
<path d="M46.5111 257L13 257C6.37258 257 1 251.627 1 245L1.00001 211.489" stroke="white" stroke-width="2" />
<path d="M1 46.5111V13C1 6.37258 6.37258 1 13 1H46.5111" stroke="white" stroke-width="2" />
</svg>
It's placed over a container div with a colored background:
body{background: white}
.container {
margin-top: 70px;
height: 400px;
margin: 0 auto;
background-color: black;
opacity: 0.55;
}
svg {
position: absolute;
top: 50px;
left: 300px;
}
I want the center of the SVG (the entire center area within the white edged borders) to be transparent. So in this example you would see the white background of the body.
Here's a CodePen of it: https://codepen.io/lance-p/pen/mdrwyyN
I was told that I could use a mask to achieve this but havent been able to get it to work. Any suggestions (with or without a mask) would be appreciated!
This is an alternative solution where I'm using a very wide shadow instead of the .container background.
Also I've simplified the svg but you can keep your code here.
*{margin:0;padding:0}
body {
background: white;
}
.container {
margin-top: 70px;
height: 400px;
margin: 0 auto;
overflow: hidden;
opacity: 0.55;
}
#hole {/*I want the hole to be slightly smaller than the svg element hence the calc*/
width:calc(258px - 8px);
height:calc(258px - 8px);
border-radius:20px;
position: relative;
top: calc(50px + 4px);
left: calc(300px + 4px);
background:transparent;
box-shadow:0 0 0 200vmax #000;
}
svg{
width:258px;
height:258px;
position: absolute;
top: 50px;
left: 300px;
}
<div class="container">
<div id="hole"></div>
</div>
<svg width="258" height="258" viewBox="0 0 258 258" xmlns="http://www.w3.org/2000/svg">
<rect x="1" y="1" width="256" height="256" rx="20" id="r" stroke="white" stroke-width="2" stroke-dasharray="80 168" stroke-dashoffset="58" fill="none" />
</svg>
#alexandr_TT is commenting:
Can somehow highlight in the description the main solution for positioning the white corners stroke-dasharray="80 168" stroke-dashoffset="58"
First you need to know the total length of the rect with rounded corners. let l = r.getTotalLength();. You divide this value by 4 to know the total of a stroke and a gap: let stroke_gap = l/4; Next you choose one value for the stroke, for example let stroke = 80. For the gap you'll use let gap = stroke_gap - stroke; I've rounded the numbers. Maybe I shouldn't. This is giving me something like stroke-dasharray="80 168" If you are using only this the first stroke will begin at a distance of 20 units (rx = "20") from the corner (x="1" y="1") You will need a stroke-dashoffset to offset the strokes and make them bent around the corners.
You can calculate the lenght of the corner part of the path: It's the length of 1/4 of the perimeter of a circle with radius = 20 (rx=20): let corner = 2 * Math.PI * radius/4; The value for the stroke-dashoffset should be let sdo = stroke/2 + corner/2
let l = r.getTotalLength();
let radius = 20;
let stroke_gap = l/4;
let stroke = 80;
let gap = stroke_gap - stroke;
let corner = 2 * Math.PI * radius/4;
let sdo = stroke/2 + corner/2;
r.setAttribute("stroke-dasharray",`${stroke} ${gap}`)
r.setAttribute("stroke-dashoffset",sdo)
<svg viewBox="0 0 258 258" xmlns="http://www.w3.org/2000/svg">
<rect x="1" y="1" width="256" height="256" rx="20" stroke="gold" stroke-width="5" fill="none" />
<rect x="1" y="1" width="256" height="256" rx="20" id="r" stroke="black" stroke-width="2" fill="none" />
<path d="M1,21A20 20 0 0 1 21,1" stroke="red" fill="none" id="corner" />
</svg>

SVG element rotate on circle

So I have a SVG element - big circle - and group of elements inside .
I would like to rotate this elements around this big circle. The code is very simply, but I'm already freaking out how to set this circle (graph__skils) on correct path (big circle). As you can see on link below this small circle isn't rotating correct on the big circle. Please help
Circle rotate jsfiddle
HTML file
<section class="graph">
<svg xmlns="http://www.w3.org/2000/svg"
width="670"
height="696"
viewBox="0 0 670 696">
<g>
<g class="graph__middle">
<path fill="#3f9" d="M345 264c34.794 0 63 28.206 63 63s-28.206 63-63 63-63-28.206-63-63 28.206-63 63-63z"/>
</g>
<g class="graph__design" >
<g class="graph_mainCircle">
<path fill="none" stroke="#cf9" stroke- linecap="round" stroke-linejoin="round" stroke-miterlimit="50" d="M345 197c71.797 0 130 58.203 130 130s-58.203 130-130 130-130-58.203-130-130 58.203-130 130-130z"/>
</g>
<g class="graph__skills">
<g class="graph__middle">
<path fill="#cf9" d="M445.053 387c11.052 0 20.012 8.954 20.012 20s-8.96 20-20.012 20-20.012-8.954-20.012-20 8.96-20 20.012-20z"/>
</g>
</g>
</g>
</g>
</svg>
SCSS file
.graph {
position: relative;
width:500px;
height:500px;
svg {
position: relative;
border: 2px solid blue;
width: 99%;
height: 99%;
}
&__design {
position: relative;
}
&__skills {
transform-origin: center;
position: absolute;
animation: mercury-group 18s linear infinite;
}
&__middle {
position: relative;
}
}
#keyframes mercury-group {
0% {
transform: rotateZ(0deg);
}
100% {
transform: rotateZ(-360deg);
}
}
The center of the svg element is not the center of your planets. You will need to change the transform-origin to 345px 328px. In order to calculate the new center I've used the getBBox() method for the graph__middle
.graph {
position: relative;
width: 500px;
height: 500px;
}
.graph svg {
position: relative;
border: 2px solid blue;
width: 99%;
height: 99%;
}
.graph__design {
position: relative;
}
.graph__skills {
transform-origin: 345px 328px;
position: absolute;
animation: mercury-group 18s linear infinite;
}
.graph__middle {
position: relative;
}
#keyframes mercury-group {
0% {
transform: rotateZ(0deg);
}
100% {
transform: rotateZ(-360deg);
}
}
<section class="graph">
<svg xmlns="http://www.w3.org/2000/svg"
width="670"
height="696"
viewBox="0 0 670 696">
<g>
<g class="graph__middle" id="KK">
<path fill="red" d="M345 264c34.794 0 63 28.206 63 63s-28.206 63-63 63-63-28.206-63-63 28.206-63 63-63z"/>
</g>
<g class="graph__design" >
<g class="graph_mainCircle">
<path fill="none" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="50" d="M345 197c71.797 0 130 58.203 130 130s-58.203 130-130 130-130-58.203-130-130 58.203-130 130-130z"/>
</g>
<g class="graph__skills">
<g class="graph__middle">
<path d="M445.053 387c11.052 0 20.012 8.954 20.012 20s-8.96 20-20.012 20-20.012-8.954-20.012-20 8.96-20 20.012-20z"/>
</g>
</g>
</g>
</g>
<circle cx="345" cy="328" r="3" />
</svg>
</section>
You can rotate the big circle instead like below:
.graph {
position: relative;
width: 500px;
height: 500px;
}
svg {
position: relative;
border: 2px solid blue;
width: 99%;
height: 99%;
}
.graph__design {
position: relative;
transform-box:fill-box;
transform-origin: center;
animation: mercury-group 18s linear infinite;
}
.graph__skills {
transform-origin: center;
position: absolute;
}
.graph__middle {
position: relative;
}
#keyframes mercury-group {
0% {
transform: rotateZ(0deg);
}
100% {
transform: rotateZ(-360deg);
}
}
<section class="graph">
<svg xmlns="http://www.w3.org/2000/svg" width="670" height="696" viewBox="0 0 670 696">
<g>
<g class="graph__middle">
<path fill="#3f9" d="M345 264c34.794 0 63 28.206 63 63s-28.206 63-63 63-63-28.206-63-63 28.206-63 63-63z"/>
</g>
<g class="graph__design" >
<g class="graph_mainCircle">
<path fill="none" stroke="#cf9" stroke- linecap="round" stroke-linejoin="round" stroke-miterlimit="50" d="M345 197c71.797 0 130 58.203 130 130s-58.203 130-130 130-130-58.203-130-130 58.203-130 130-130z"/>
</g>
<g class="graph__skills">
<g class="graph__middle">
<path fill="#cf9" d="M445.053 387c11.052 0 20.012 8.954 20.012 20s-8.96 20-20.012 20-20.012-8.954-20.012-20 8.96-20 20.012-20z"/>
</g>
</g>
</g>
</g>
</svg>
</section>
SVG example
My example doesn't answer exactly your question but I hope you take some ideas from my answer.
Judging by the names of the animation mercury-group you want to create a model of the solar system.
I propose a variant of the animation of the rotation of the planet around the sun.
I located the center of rotation of the planets of the solar system in the center of the sun which has coordinates x =" 250 " y =" 175 " center of the sun
Therefore, the animation team of the rotation of the planet around the sun has the following form:
<animateTransform
attributeName="transform"
type="rotate"
values="0 250 175;360 250 175"
dur="12s"
repeatCount="indefinite"
/>
Filters and gradients are used to design the appearance of the planet and the sun.
Animation of the ripple of the sun and changing its color
<radialGradient id="gradSun">
<stop offset="80%" stop-color="yellow">
<animate attributeName="offset" values="80%;20%;80%" dur="6s" repeatCount="indefinite" />
</stop>
<stop offset="100%" stop-color="gold" >
<animate attributeName="stop-color" values="gold;red;gold" dur="6s" repeatCount="indefinite" />
</stop>
</radialGradient>
Below is the full animation code for the rotation of the planet around the sun:
.solar-system{
background-color:#002;
width:100%;
height:100%;
}
.sun{
fill:url(#gradSun);
filter:url(#dropShadow2);
}
.Earth-orbit{
stroke:rgba(255,255,255,.4);
stroke-width:1;
fill:none;
}
.Earth{
filter:url(#dropShadow1);
fill:url(#gradEarth);
}
<div class="solar-system">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 500 400" >
<defs>
<filter id="dropShadow1"
x="-20%" y="-20%"
width="150%" height="150%">
<feGaussianBlur stdDeviation="1" />
</filter>
<filter id="dropShadow2"
x="-20%" y="-20%"
width="150%" height="150%">
<feGaussianBlur stdDeviation="4" />
</filter>
<radialGradient id="gradSun">
<stop offset="80%" stop-color="yellow">
<animate attributeName="offset" values="80%;20%;80%" dur="6s" repeatCount="indefinite" />
</stop>
<stop offset="100%" stop-color="gold" >
<animate attributeName="stop-color" values="gold;red;gold" dur="6s" repeatCount="indefinite" />
</stop>
</radialGradient>
<linearGradient id="gradEarth">
<stop offset="40%" stop-color="dodgerblue"></stop>
<stop offset="100%" stop-color="yellowgreen" ></stop>
</linearGradient>
</defs>
<!-- planet rotation animation -->
<g>
<animateTransform
attributeName="transform"
type="rotate"
values="360 250 175;0 250 175"
dur="12s"
repeatCount="indefinite"
/>
<circle class="Earth-orbit" cx="250" cy="175" r="90" />
<circle class="Earth" cx="160" cy="175" r="10" transform="rotate(45 250 175)" />
</g>
<circle class="sun" cx="250" cy="175" r="20" />
</svg>
First, You must set key frames then use css animation
#-webkit-keyframes rotated {
0% {
-webkit-transform: rotate(0);
transform: rotate(0);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}}
#keyframes rotated {
0% {
-webkit-transform: rotate(0);
transform: rotate(0);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}}
Then use animation in css
.bg-shape{
animation: rotated 35s linear infinite;}
Then in html use svg image to rotate
<div class="col-lg-4">
<div class="inner-wrapper text-center">
<div class="mb-3">
<img src="../img/svg/shape-37.svg" alt="" class="bg-shape">
</div>
</div>
</div>

SVG sprite on stack don't appear on Safarii

I created SVG sprite, where icons are on stack and displayed when targeting chosen ID. It works ok, but I don't know why, icons not appear on Safari, I can't find explanation in case when you're using SVG as a background. Is any one familiar with this problem?
SVG
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="icon" class="icon" version="1.1">
<defs>
<style>
svg .icon {
display: none;
}
svg .icon:target {
display: inline-block;
}
</style>
</defs>
<svg viewBox="0 0 24 24">
<g id="icon-instagram" class="icon" fill="#fff">
<path fill-rule="nonzero"
d="M17.2808471,0 L6.58644706,0 C2.95468235,0 0,2.95482353 0,6.58658824 L0,17.2809882 C0,20.9128941 2.95468235,23.8675765 6.58644706,23.8675765 L17.2808471,23.8675765 C20.9128941,23.8675765 23.8675765,20.9127529 23.8675765,17.2809882 L23.8675765,6.58658824 C23.8677176,2.95482353 20.9128941,0 17.2808471,0 Z M21.7500706,17.2809882 C21.7500706,19.7452235 19.7452235,21.7499294 17.2809882,21.7499294 L6.58644706,21.7499294 C4.12235294,21.7500706 2.11764706,19.7452235 2.11764706,17.2809882 L2.11764706,6.58658824 C2.11764706,4.12249412 4.12235294,2.11764706 6.58644706,2.11764706 L17.2808471,2.11764706 C19.7450824,2.11764706 21.7499294,4.12249412 21.7499294,6.58658824 L21.7499294,17.2809882 L21.7500706,17.2809882 Z"/>
<path fill-rule="nonzero"
d="M11.9337882 5.784C8.54258824 5.784 5.78371765 8.54287059 5.78371765 11.9340706 5.78371765 15.3251294 8.54258824 18.0838588 11.9337882 18.0838588 15.3249882 18.0838588 18.0838588 15.3251294 18.0838588 11.9340706 18.0838588 8.54287059 15.3249882 5.784 11.9337882 5.784zM11.9337882 15.9660706C9.7104 15.9660706 7.90136471 14.1573176 7.90136471 11.9339294 7.90136471 9.7104 9.71025882 7.90150588 11.9337882 7.90150588 14.1573176 7.90150588 15.9662118 9.7104 15.9662118 11.9339294 15.9662118 14.1573176 14.1571765 15.9660706 11.9337882 15.9660706zM18.3417882 3.98837647C17.9337882 3.98837647 17.5329882 4.15355294 17.2448471 4.44296471 16.9552941 4.73096471 16.7888471 5.13190588 16.7888471 5.54131765 16.7888471 5.94945882 16.9554353 6.35025882 17.2448471 6.63967059 17.5328471 6.92767059 17.9337882 7.09425882 18.3417882 7.09425882 18.7512 7.09425882 19.1507294 6.92767059 19.4401412 6.63967059 19.7295529 6.35025882 19.8947294 5.94931765 19.8947294 5.54131765 19.8947294 5.13190588 19.7295529 4.73096471 19.4401412 4.44296471 19.1521412 4.15355294 18.7512 3.98837647 18.3417882 3.98837647z"/>
</g>
</svg>
<svg viewBox="0 0 24 24">
<g id="icon-facebook" class="icon" fill="#fff">
<path d="M2.93630055,4.93539414 L2.93630055,8.17223941 L0.564884222,8.17223941 L0.564884222,12.1302664 L2.93630055,12.1302664 L2.93630055,23.8921306 L7.80769311,23.8921306 L7.80769311,12.1305943 L11.0766237,12.1305943 C11.0766237,12.1305943 11.3827734,10.2327507 11.5311748,8.15764524 L7.82611347,8.15764524 L7.82611347,5.45138285 C7.82611347,5.04690017 8.35724295,4.50281631 8.88219587,4.50281631 L11.5363128,4.50281631 L11.5363128,0.382285714 L7.92761676,0.382285714 C2.81588497,0.382012415 2.93630055,4.34397487 2.93630055,4.93539414 Z"/>
</g>
</svg>
CSS
.icon-instagram {
width: 24px;
height: 24px;
background: url("../svg/viva-sprite.svg#icon-instagram") no-repeat;
}
.icon-facebook {
width: 24px;
height: 24px;
background: url("../svg/viva-sprite.svg#icon-facebook") no-repeat;
}

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

Resources