How to make the animation smooth in the below SVG? - svg

Im trying to make the below svg animation smooth. I would want to make the white gradient to move through the path indefinitely. Any suggestions would be very helpful.
<svg width="8" height="243" viewBox="0 0 8 243" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3 3L3 240" stroke="url(#paint0_linear)" strokeWidth="5" strokeLinecap="round" strokeLinejoin="round"/>
<defs>
<linearGradient id="paint0_linear" x1="3" y1="3" x2="3" y2="240" gradientUnits="userSpaceOnUse">
<stop offset="0" stopColor="#E8FF00" stopOpacity="1">
<animate attributeName="stop-opacity" values="1;1;1;0;0;0.5;0.8;1;1;1;1;1" dur="1s" repeatCount="indefinite" />
</stop>
<stop offset="0.3" stopColor="#E8FF00" stopOpacity="0">
<animate attributeName="offset" values="0.3;0.2;0.1;0;1;0.9;0.8;0.7;0.6;0.5;0.4;0.3" dur="1s" repeatCount="indefinite" />
</stop>
<stop offset="0.4" stopColor="#E8FF00" stopOpacity="0">
<animate attributeName="offset" values="0.4;0.3;0.2;0.1;0;1;0.9;0.8;0.7;0.6;0.5;0.4" dur="1s" repeatCount="indefinite" />
</stop>
<stop offset="0.5" stopColor="#E8FF00" stopOpacity="0">
<animate attributeName="offset" values="0.5;0.4;0.3;0.2;0.1;0;1;0.9;0.8;0.7;0.6;0.5" dur="1s" repeatCount="indefinite" />
</stop>
<stop offset="1" stopColor="#E8FF00" stopOpacity="1">
<animate attributeName="stop-opacity" values="1;1;1;1;0.8;0.5;0;0;0;1;1;1" dur="1s" repeatCount="indefinite" />
</stop>
</linearGradient>
</defs>
</svg>

Consider solving a gradient animation using gradientTransform
Below is the code showing the position of the white bar in the static version
<svg width="108" height="243" viewBox="0 0 108 243" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="3" y="3" width="5" rx="5" height="240" fill="url(#paint0_linear)" />
<defs>
<linearGradient id="paint0_linear" x1="0%" y1="0%" x2="0%" y2="100%"" >
<stop offset="0%" stop-color="grey" />
<stop offset="43%" stop-color="grey" />
<stop offset="50%" stop-color="white" />
<stop offset="57%" stop-color="grey" />
<stop offset="100%" stop-color="grey" />
</linearGradient>
</defs>
</svg>
Add an animation command to move the entire gradient from top to bottom
<animateTransform attributeName="gradientTransform" ... />
<svg width="108" height="243" viewBox="0 0 108 243" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="3" y="3" width="5" rx="5" height="240" fill="url(#paint0_linear)" />
<defs>
<linearGradient id="paint0_linear" x1="0%" y1="0%" x2="0%" y2="100%" >
<stop offset="0%" stop-color="grey" />
<stop offset="43%" stop-color="grey" />
<stop offset="50%" stop-color="white" />
<stop offset="57%" stop-color="grey" />
<stop offset="100%" stop-color="grey" />
<animateTransform attributeName="gradientTransform"
type="translate"
from="0 -1"
to="0 1"
begin="0s"
dur="1.5s"
repeatCount="indefinite"/>
</linearGradient>
</defs>
</svg>
Update
#tejash jl comments:
animationTransform is not working on line path
I changed your path a little
<svg width="108" height="243" viewBox="0 0 108 243" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3 3L3 240 L6 240 L6 3z" fill="url(#paint0_linear)" stroke-linecap="round" stroke-linejoin="round"/>
<defs>
<linearGradient id="paint0_linear" x1="0%" y1="0%" x2="0%" y2="100%" >
<stop offset="0%" stop-color="grey" />
<stop offset="43%" stop-color="grey" />
<stop offset="50%" stop-color="white" />
<stop offset="57%" stop-color="grey" />
<stop offset="100%" stop-color="grey" />
<animateTransform attributeName="gradientTransform"
type="translate"
from="0 -1"
to="0 1"
begin="0s"
dur="1.5s"
repeatCount="indefinite"/>
</linearGradient>
</defs>
</svg>
The path must be closed for the gradient animation to work. But you can also select a polyline and apply a gradient to the line
<svg width="108" height="243" viewBox="0 0 108 243" fill="none" xmlns="http://www.w3.org/2000/svg">
<polyline points="3,3 3,240" stroke="url(#paint0_linear)" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<defs>
<linearGradient id="paint0_linear" x1="3" y1="3" x2="3" y2="240" gradientUnits="userSpaceOnUse" >
<stop offset="0" stop-color="grey" />
<stop offset=".43" stop-color="grey" />
<stop offset=".50" stop-color="white" />
<stop offset=".57" stop-color="grey" />
<stop offset="1" stop-color="grey" />
<animateTransform attributeName="gradientTransform"
type="translate"
from="0 -240"
to="0 240"
begin="0s"
dur="1.5s"
repeatCount="indefinite"/>
</linearGradient>
</defs>
</svg>

Related

How can I rewrite a gradient with userSpaceOnUse to objectBoundingBox?

I have this gradient that uses userSpaceOnUse.
<svg height="400px" width="800px" viewBox="0 0 800 400" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="grad1" x1="0" y1="0" x2="800" y2="400" gradientUnits="userSpaceOnUse">
<stop offset="0%" style="stop-color:green;stop-opacity:1" />
<stop offset="50%" style="stop-color:black;stop-opacity:1" />
<stop offset="100%" style="stop-color:red;stop-opacity:1" />
</linearGradient>
</defs>
<rect x="0" y="0" width="800" height="400" fill="url(#grad1)"/>
</svg>
I want to rewrite it to use objectBoundingBox but be rendered the same. How can I do this?
I imagine the rewritten SVG would be close to:
<svg height="400px" width="800px" viewBox="0 0 800 400" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="grad1" x1="0" y1="0" x2="1" y2="1" gradientUnits="objectBoundingBox">
<stop offset="0%" style="stop-color:green;stop-opacity:1" />
<stop offset="50%" style="stop-color:black;stop-opacity:1" />
<stop offset="100%" style="stop-color:red;stop-opacity:1" />
</linearGradient>
</defs>
<rect x="0" y="0" width="800" height="400" fill="url(#grad1)"/>
</svg>
This answer (https://stackoverflow.com/a/50624704/1283776) indicates that I need to use a transform, but I haven't been successful in found a solution.
<!-- https://stackoverflow.com/questions/22214999/svg-linear-gradient-independent-of-the-shape-coordinates -->
<svg height="400px" width="800px" viewBox="0 0 800 400" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="grad1" x1="0" y1="0" x2="1" y2="0.5" gradientUnits="objectBoundingBox" gradientTransform="scale(1, 2)">
<stop offset="0%" style="stop-color:green;stop-opacity:1" />
<stop offset="50%" style="stop-color:black;stop-opacity:1" />
<stop offset="100%" style="stop-color:red;stop-opacity:1" />
</linearGradient>
</defs>
<rect x="0" y="0" width="800" height="400" fill="url(#grad1)"/>
</svg>

SVG fill figure and its negative in different colours

I'm having trouble creating a gardient in a svg image. I need to fill the figure as its progress increase (0~100% or 0~1) but also the negative of the figure path.
Let me show what I need with some images to be more clear.
This is what I can achieve:
Already Done
And this is what I need:
Hope to achieve
Is there a simple way to achieve this?
EDIT: Sorry, this is my SVG code:
<svg id="Capa_1" enable-background="new 0 0 503.353 503.353" height="512" viewBox="0 0 503.353 503.353" width="512" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="gradient" x1="0%" y1="0%" x2="0%" y2="100%">
<stop stop-color="#aaa" offset="0" />
<stop stop-color="#aaa" offset="1">
<animate dur="2s" by="-0.5" attributeName="offset" fill="freeze" calcMode="spline" keyTimes="0;1" keySplines="0.4, 0, 0.2, 1" />
</stop>
<stop stop-color="green" offset="1">
<animate dur="2s" by="-0.5" attributeName="offset" fill="freeze" calcMode="spline" keyTimes="0;1" keySplines="0.4, 0, 0.2, 1" />
</stop>
<stop stop-color="green" offset="1" />
</linearGradient>
</defs>
<path class="kiwi" d="m483.142 269.401-1.281-12.05-12.05-1.281c-1.145-.121-9.029-.899-21.262-.838-.005-.412-.001-.824-.009-1.236-1.83-95.103-83.035-161.783-86.491-164.575l-9.426-7.616-9.426 7.616c-.768.621-5.382 4.403-12.108 10.948-24.406-55.352-67.489-90.736-69.986-92.753l-9.426-7.616-9.426 7.616c-2.49 2.011-45.318 37.183-69.764 92.245-6.44-6.232-10.835-9.835-11.583-10.439l-9.426-7.616-9.426 7.616c-3.456 2.792-84.661 69.472-86.491 164.575-.008.414-.004.826-.009 1.24-12.662-.098-20.841.71-22.01.834l-12.05 1.281-1.281 12.05c-.47 4.418-10.74 108.988 55.213 177.53 36.076 37.492 87.354 56.422 152.663 56.422 7.668 0 15.537-.269 23.59-.791 8.057.523 15.917.791 23.59.791 65.303 0 116.589-18.932 152.663-56.422 65.952-68.543 55.682-173.113 55.212-177.531zm-130.519-148.024c19.981 19.489 64.799 70.155 65.927 133.393.013.733.002 1.465.004 2.198-23.708 2.614-52.747 8.816-80.739 22.639-10.149-29.958-26.595-55.141-41.675-73.83 14.488-39.789 42.01-70.284 56.483-84.4zm-100.946 345.907c-44.573-42.071-66.743-86.537-65.926-132.316 1.127-63.242 45.954-113.913 65.926-133.392 19.981 19.489 64.799 70.155 65.927 133.392.815 45.779-21.354 90.244-65.927 132.316zm-.001-427.713c14.614 14.254 42.507 45.186 56.882 85.514-12.001 14.807-24.912 33.756-34.854 55.966-6.991-6.838-11.814-10.794-12.601-11.43l-9.426-7.616-9.426 7.616c-.767.62-5.371 4.395-12.082 10.923-10.056-22.312-23.091-41.309-35.146-56.097 14.441-40.021 42.123-70.704 56.653-84.876zm-166.124 215.199c1.127-63.242 45.954-113.913 65.926-133.393 14.402 14.047 41.701 44.292 56.249 83.765-15.218 18.751-31.923 44.168-42.187 74.464-27.697-13.677-56.423-19.896-79.991-22.557 0-.76-.011-1.519.003-2.279zm11.625 171.501c-43.922-45.516-48.054-113.042-47.706-140.938 21.81-.277 67.78 2.211 108.551 24.244-1.303 7.968-2.101 16.179-2.264 24.619-.936 48.66 19.036 95.238 59.414 138.849-50.56-2.269-90.153-17.923-117.995-46.774zm308.999 0c-27.843 28.855-67.441 44.526-118.002 46.781 40.382-43.613 60.357-90.193 59.42-138.856-.162-8.44-.961-16.651-2.263-24.619 40.783-22.038 86.768-24.519 108.55-24.245.348 27.909-3.787 95.426-47.705 140.939z"/>
</svg>
And the CSS class:
.kiwi {
fill: url(#gradient);
position: absolute;
height: auto;
}
Thanks!
Well the easy way based on what your path looks like is just to copy part of the shape that draws the outline, put it underneath your existing shape and animate it using a different gradient.
(A slightly better way would have been to draw the shape using a fat stroke rather than a fill and put a different gradient on the stroke and the fill using gradientUnits= userSpaceOnUse.)
.kiwi {
fill: url(#gradient1);
position: absolute;
height: auto;
}
.anzac {
fill: url(#gradient2);
position: absolute;
height: auto;
}
<svg id="Capa_1" enable-background="new 0 0 503.353 503.353" height="512" viewBox="0 0 503.353 503.353" width="512" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="gradient1" x1="0%" y1="0%" x2="0%" y2="100%">
<stop stop-color="#aaa" offset="0" />
<stop stop-color="#aaa" offset="1">
<animate dur="2s" by="-0.5" attributeName="offset" fill="freeze" calcMode="spline" keyTimes="0;1" keySplines="0.4, 0, 0.2, 1" />
</stop>
<stop stop-color="green" offset="1">
<animate dur="2s" by="-0.5" attributeName="offset" fill="freeze" calcMode="spline" keyTimes="0;1" keySplines="0.4, 0, 0.2, 1" />
</stop>
<stop stop-color="green" offset="1" />
</linearGradient>
<linearGradient id="gradient2" x1="0%" y1="0%" x2="0%" y2="100%">
<stop stop-color="#aaa" offset="0" />
<stop stop-color="#aaa" offset="1">
<animate dur="2s" by="-0.5" attributeName="offset" fill="freeze" calcMode="spline" keyTimes="0;1" keySplines="0.4, 0, 0.2, 1" />
</stop>
<stop stop-color="blue" offset="1">
<animate dur="2s" by="-0.5" attributeName="offset" fill="freeze" calcMode="spline" keyTimes="0;1" keySplines="0.4, 0, 0.2, 1" />
</stop>
<stop stop-color="blue" offset="1" />
</linearGradient>
</defs>
<path class="anzac" d="m483.142 269.401-1.281-12.05-12.05-1.281c-1.145-.121-9.029-.899-21.262-.838-.005-.412-.001-.824-.009-1.236-1.83-95.103-83.035-161.783-86.491-164.575l-9.426-7.616-9.426 7.616c-.768.621-5.382 4.403-12.108 10.948-24.406-55.352-67.489-90.736-69.986-92.753l-9.426-7.616-9.426 7.616c-2.49 2.011-45.318 37.183-69.764 92.245-6.44-6.232-10.835-9.835-11.583-10.439l-9.426-7.616-9.426 7.616c-3.456 2.792-84.661 69.472-86.491 164.575-.008.414-.004.826-.009 1.24-12.662-.098-20.841.71-22.01.834l-12.05 1.281-1.281 12.05c-.47 4.418-10.74 108.988 55.213 177.53 36.076 37.492 87.354 56.422 152.663 56.422 7.668 0 15.537-.269 23.59-.791 8.057.523 15.917.791 23.59.791 65.303 0 116.589-18.932 152.663-56.422 65.952-68.543 55.682-173.113 55.212-177.531z"/>
<path class="kiwi" d="m483.142 269.401-1.281-12.05-12.05-1.281c-1.145-.121-9.029-.899-21.262-.838-.005-.412-.001-.824-.009-1.236-1.83-95.103-83.035-161.783-86.491-164.575l-9.426-7.616-9.426 7.616c-.768.621-5.382 4.403-12.108 10.948-24.406-55.352-67.489-90.736-69.986-92.753l-9.426-7.616-9.426 7.616c-2.49 2.011-45.318 37.183-69.764 92.245-6.44-6.232-10.835-9.835-11.583-10.439l-9.426-7.616-9.426 7.616c-3.456 2.792-84.661 69.472-86.491 164.575-.008.414-.004.826-.009 1.24-12.662-.098-20.841.71-22.01.834l-12.05 1.281-1.281 12.05c-.47 4.418-10.74 108.988 55.213 177.53 36.076 37.492 87.354 56.422 152.663 56.422 7.668 0 15.537-.269 23.59-.791 8.057.523 15.917.791 23.59.791 65.303 0 116.589-18.932 152.663-56.422 65.952-68.543 55.682-173.113 55.212-177.531zm-130.519-148.024c19.981 19.489 64.799 70.155 65.927 133.393.013.733.002 1.465.004 2.198-23.708 2.614-52.747 8.816-80.739 22.639-10.149-29.958-26.595-55.141-41.675-73.83 14.488-39.789 42.01-70.284 56.483-84.4zm-100.946 345.907c-44.573-42.071-66.743-86.537-65.926-132.316 1.127-63.242 45.954-113.913 65.926-133.392 19.981 19.489 64.799 70.155 65.927 133.392.815 45.779-21.354 90.244-65.927 132.316zm-.001-427.713c14.614 14.254 42.507 45.186 56.882 85.514-12.001 14.807-24.912 33.756-34.854 55.966-6.991-6.838-11.814-10.794-12.601-11.43l-9.426-7.616-9.426 7.616c-.767.62-5.371 4.395-12.082 10.923-10.056-22.312-23.091-41.309-35.146-56.097 14.441-40.021 42.123-70.704 56.653-84.876zm-166.124 215.199c1.127-63.242 45.954-113.913 65.926-133.393 14.402 14.047 41.701 44.292 56.249 83.765-15.218 18.751-31.923 44.168-42.187 74.464-27.697-13.677-56.423-19.896-79.991-22.557 0-.76-.011-1.519.003-2.279zm11.625 171.501c-43.922-45.516-48.054-113.042-47.706-140.938 21.81-.277 67.78 2.211 108.551 24.244-1.303 7.968-2.101 16.179-2.264 24.619-.936 48.66 19.036 95.238 59.414 138.849-50.56-2.269-90.153-17.923-117.995-46.774zm308.999 0c-27.843 28.855-67.441 44.526-118.002 46.781 40.382-43.613 60.357-90.193 59.42-138.856-.162-8.44-.961-16.651-2.263-24.619 40.783-22.038 86.768-24.519 108.55-24.245.348 27.909-3.787 95.426-47.705 140.939z"/>
</svg>

What’s causing the linear-gradient to degrade in image quality when placed on Blogger?

After it is placed on Blogger, the hue of the linear gradient drops/lessens dramatically.
How do I prevent this from happening?
Is there any possible way I can fix this so it stays the same?
https://jsfiddle.net/cs311dLn/1/
https://testpage34567.blogspot.com/
The linear-gradient in the images are the 2 lines in the middle going down.
.html
Screenshot
Blogger:
Screenshot
<svg width="260" height="194">
<defs>
<clippath id="circleView">
<circle cx="130" cy="97" r="85" fill="orange"></circle>
</clippath>
</defs>
<image x="40" y="7" width="180" height="180" xlink:href="https://i.imgur.com/BO6KOvw.jpg" clip-path="url(#circleView)"> </image>
<image x="40" y="7" width="180" height="180" xlink:href="http://i.imgur.com/4HJbzEq.png"></image>
<svg width="260" height="194">
<defs>
<lineargradient id="MyGradient">
<stop offset="0%" stop-color="transparent"></stop>
<stop offset="31.9%" stop-color="transparent"></stop>
<stop offset="31.9%" stop-color="#0059dd"></stop>
<stop offset="33.2%" stop-color="#0059dd"></stop>
<stop offset="33.2%" stop-color="transparent"></stop>
<stop offset="66.8%" stop-color="transparent"></stop>
<stop offset="66.8%" stop-color="#0059dd"></stop>
<stop offset="68.1%" stop-color="#0059dd"></stop>
<stop offset="68.1%" stop-color="transparent"></stop>
<stop offset="100%" stop-color="transparent"></stop>
</lineargradient>
</defs>
<rect fill="url(#MyGradient)" x="0" y="0" width="260" height="194"></rect>
</svg>
</svg>

SVG Animations pattern edge

I want to create stripe animated background but for some reason can't remove vertical lines that appear on the edge of patterns.
Here is my svg:
<svg width="500" height="500">
<defs>
<linearGradient id='stripe-gradient' x1='0%' y1='0%' x2='100%' y2='100%'>
<stop offset='0%' stop-color='#AAA'></stop>
<stop offset='24.9%' stop-color='#AAA'></stop>
<stop offset='25%' stop-color='#666'></stop>
<stop offset='49.9%' stop-color='#666'></stop>
<stop offset='50%' stop-color='#AAA'></stop>
<stop offset='74.9%' stop-color='#AAA'></stop>
<stop offset='75%' stop-color='#666'></stop>
<stop offset='99.9%' stop-color='#666'></stop>
<stop offset='100%' stop-color='#AAA'></stop>
</linearGradient>
<pattern id='stripe-pattern' width='20' height='20' patternUnits='userSpaceOnUse' >
<rect x='-20' y='0' width='20' height='20' fill='url(#stripe-gradient)' stroke-width='0' stroke='none'>
<animate attributeName='x' from='-20' to='0' dur='0.5s' repeatCount='indefinite'></animate>
</rect>
<rect x='0' y='0' width='20' height='20' fill='url(#stripe-gradient)' stroke-width='0' stroke='none'>
<animate attributeName='x' from='0' to='20' dur='0.5s' repeatCount='indefinite'></animate>
</rect>
</pattern>
<mask id='stripe-mask'>
<rect x='0' y='0' width='100%' height='100%' fill='url(#stripe-pattern)' ></rect>
</mask>
</defs>
<rect class="hbar thing" x="0" y="0" width="200" fill="green" height="200" mask="url(#stripe-mask)"></rect>
</svg>
I know this post is a bit old but in case you still need to solve this issue I have made it work by doubling the stripes, removing one of the rects inside the pattern and then doubling the size of the last rect, c.f., the following code:
<svg width="500" height="500">
<defs>
<linearGradient id='stripe-gradient' x1='0%' y1='0%' x2='100%' y2='100%'>
<stop offset='0%' stop-color='#AAA'></stop>
<stop offset='12.45%' stop-color='#AAA'></stop>
<stop offset='12.5%' stop-color='#666'></stop>
<stop offset='24.45%' stop-color='#666'></stop>
<stop offset='25.5%' stop-color='#AAA'></stop>
<stop offset='37.45%' stop-color='#AAA'></stop>
<stop offset='37.5%' stop-color='#666'></stop>
<stop offset='49.9%' stop-color='#666'></stop>
<stop offset='50%' stop-color='#AAA'></stop>
<stop offset='62.45%' stop-color='#AAA'></stop>
<stop offset='62.5%' stop-color='#666'></stop>
<stop offset='74.95%' stop-color='#666'></stop>
<stop offset='75%' stop-color='#AAA'></stop>
<stop offset='87.45%' stop-color='#AAA'></stop>
<stop offset='87.5%' stop-color='#666'></stop>
<stop offset='100%' stop-color='#666'></stop>
</linearGradient>
<pattern id='stripe-pattern' width='20' height='20' patternUnits='userSpaceOnUse' >
<rect x='-20' y='0' width='40' height='40' fill='url(#stripe-gradient)' stroke-width='0' stroke='none'>
<animate attributeName='x' from='-20' to='0' dur='0.5s' repeatCount='indefinite'></animate>
</rect>
</pattern>
<mask id='stripe-mask'>
<rect x='0' y='0' width='100%' height='100%' fill='url(#stripe-pattern)'></rect>
</mask>
</defs>
<rect x="0" y="0" width="200" fill="green" height="200" mask="url(#stripe-mask)"></rect>
</svg>
I think the vertical stripes appeared as a result of some small numerical issues whenever the browser calculates the position of the two rects. Therefore, the solution is to use only one rect.

svg transform moves image offscreen when going up

Objective:
To move an svg image (elevator car) along a y-axis in the upwards or downwards position.
The image moves as I would like but the problem is that when it goes upwards, it disappears off the screen. I learned that altering the height of the viewBox:
viewBox="0 0 900.7 701.9" (701.9) in this instance would increase the box in where this svg would stay visible.
Although, it seems that this only lets me move it downwards more, not upwards.
I have a jsfiddle set up that gets right to the point. As much as I have read about the svg viewBox, I feel like I am not understanding something about it. Please take a look, thanks.
https://jsfiddle.net/adamb7x/ungetpax/22/
You're going off the top of the SVG canvas. If you start lower you'll have more room to go up.
I've wrapped the drawing in an extra <g> tag that translates stuff down as Snap doesn't seem to have additive animation support.
var rearCab = Snap('#RearCab');
var rCab = rearCab.select('#RCab');
document.getElementById("up").addEventListener("click",function(){
rCab.animate({
transform: 't0,-350'
}, 1000);
})
document.getElementById("down").addEventListener("click",function(){
rCab.animate({
transform: 't0,350'
}, 1000);
})
div.rearCab{
top: 30%;
left: 30%;
position: absolute;
width: 250px;
height: 250px;
}
.st0 {
clip-path: url(#SVGID_2_);
fill: url(#SVGID_3_);
}
.st1 {
fill: #1C1C1C;
}
.st2 {
clip-path: url(#SVGID_5_);
fill: url(#SVGID_6_);
}
.st3 {
fill: url(#SVGID_7_);
}
.st4 {
fill: url(#SVGID_8_);
}
.st5 {
fill: url(#SVGID_9_);
}
.st6 {
fill: url(#SVGID_10_);
}
.st7 {
fill: url(#SVGID_11_);
}
.st8 {
fill: url(#SVGID_12_);
}
.st9 {
fill: url(#SVGID_13_);
}
.st10 {
display: none;
}
.st11 {
display: inline;
}
.st12 {
clip-path: url(#SVGID_15_);
fill: url(#SVGID_16_);
}
.st13 {
display: inline;
fill: #1C1C1C;
}
.st14 {
clip-path: url(#SVGID_18_);
fill: url(#SVGID_19_);
}
.st15 {
fill: url(#SVGID_20_);
}
.st16 {
fill: url(#SVGID_21_);
}
.st17 {
fill: url(#SVGID_22_);
}
.st18 {
fill: url(#SVGID_23_);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/snap.svg/0.4.1/snap.svg-min.js"></script>
<div class="rearCab">
<svg version="1.1" id="RearCab" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 900.7 901.9" style="enable-background:new 0 0 100.7 151.9;" xml:space="preserve">
<g transform="translate(0, 350)">
<g id="RCab">
<g id="RightDoorRear_1_">
<g id="RightDoorRear">
<g>
<g>
<g>
<g>
<g>
<g>
<g>
<defs>
<rect id="SVGID_1_" x="50.1" y="25.6" width="28.4" height="116.5" />
</defs>
<clipPath id="SVGID_2_">
<use xlink:href="#SVGID_1_" style="overflow:visible;" />
</clipPath>
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="-1799.5736" y1="-924.9411" x2="-1741.5736" y2="-924.9411" gradientTransform="matrix(-1 0 0 1 -1721.0736 1008.1411)">
<stop offset="2.688172e-02" style="stop-color:#5A5B5D" />
<stop offset="0.2742" style="stop-color:#CACCCE" />
<stop offset="0.439" style="stop-color:#C8CACC" />
<stop offset="0.5121" style="stop-color:#C1C3C5" />
<stop offset="0.5215" style="stop-color:#C0C1C3" />
<stop offset="0.6609" style="stop-color:#C2C3C5" />
<stop offset="0.7111" style="stop-color:#C8CACC" />
<stop offset="0.7204" style="stop-color:#CACCCE" />
<stop offset="0.7608" style="stop-color:#C1C2C4" />
<stop offset="0.8282" style="stop-color:#A7A9AB" />
<stop offset="0.9138" style="stop-color:#7E7F81" />
<stop offset="0.9785" style="stop-color:#5A5B5D" />
</linearGradient>
<polygon class="st0" points="20.5,24.3 78.5,24.3 78.5,142.1 20.5,142.1 " />
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
<rect x="49.8" y="25.6" class="st1" width="0.3" height="116.5" />
</g>
<g id="LeftDoorRear">
<g id="LeftDoor">
<g>
<g>
<g>
<g>
<g>
<g>
<g>
<defs>
<rect id="SVGID_4_" x="21.5" y="25.6" width="28.8" height="116.5" />
</defs>
<clipPath id="SVGID_5_">
<use xlink:href="#SVGID_4_" style="overflow:visible;" />
</clipPath>
<linearGradient id="SVGID_6_" gradientUnits="userSpaceOnUse" x1="21.5" y1="106.7" x2="80.4" y2="106.7" gradientTransform="matrix(1 0 0 -1 0 191.2)">
<stop offset="2.688172e-02" style="stop-color:#5A5B5D" />
<stop offset="0.2742" style="stop-color:#CACCCE" />
<stop offset="0.439" style="stop-color:#C8CACC" />
<stop offset="0.5121" style="stop-color:#C1C3C5" />
<stop offset="0.5215" style="stop-color:#C0C1C3" />
<stop offset="0.6609" style="stop-color:#C2C3C5" />
<stop offset="0.7111" style="stop-color:#C8CACC" />
<stop offset="0.7204" style="stop-color:#CACCCE" />
<stop offset="0.7608" style="stop-color:#C1C2C4" />
<stop offset="0.8282" style="stop-color:#A7A9AB" />
<stop offset="0.9138" style="stop-color:#7E7F81" />
<stop offset="0.9785" style="stop-color:#5A5B5D" />
</linearGradient>
<rect x="21.5" y="25.6" class="st2" width="58.9" height="117.8" />
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
<rect x="49.8" y="25.6" class="st1" width="0.3" height="116.5" />
</g>
<g id="CeilingandFloor">
<linearGradient id="SVGID_7_" gradientUnits="userSpaceOnUse" x1="-5430.1064" y1="244.7255" x2="-5430.1064" y2="178.3705" gradientTransform="matrix(-0.8862 0 0 -1 -4729.9604 231.2)">
<stop offset="0" style="stop-color:#E5E2DF" />
<stop offset="0" style="stop-color:#D9D4D0" />
<stop offset="0" style="stop-color:#CCC6C1" />
<stop offset="6.668396e-02" style="stop-color:#BDB8B4" />
<stop offset="0.1461" style="stop-color:#A6A29F" />
<stop offset="0.8764" style="stop-color:#A6A29F" />
<stop offset="1" style="stop-color:#D0D2D3" />
<stop offset="1" style="stop-color:#A6A8AB" />
</linearGradient>
<polygon class="st3" points="85.9,14.7 78.5,25.2 78.5,151.9 85.9,151.9 " />
<linearGradient id="SVGID_8_" gradientUnits="userSpaceOnUse" x1="18.15" y1="245.4305" x2="18.15" y2="178.7922" gradientTransform="matrix(1 0 0 -1 0 231.2)">
<stop offset="0" style="stop-color:#E5E2DF" />
<stop offset="0" style="stop-color:#D9D4D0" />
<stop offset="0" style="stop-color:#CCC6C1" />
<stop offset="6.668396e-02" style="stop-color:#BDB8B4" />
<stop offset="0.1461" style="stop-color:#A6A29F" />
<stop offset="0.8764" style="stop-color:#A6A29F" />
<stop offset="1" style="stop-color:#D0D2D3" />
<stop offset="1" style="stop-color:#A6A8AB" />
</linearGradient>
<polygon class="st4" points="14.8,14.1 21.5,24.7 21.5,151.9 14.8,151.9 " />
<linearGradient id="SVGID_9_" gradientUnits="userSpaceOnUse" x1="-4755.9702" y1="-2614.2454" x2="-4755.9702" y2="-2628.8735" gradientTransform="matrix(-1 0 0 1 -4705.5703 2768.1921)">
<stop offset="0.2903" style="stop-color:#555658" />
<stop offset="1" style="stop-color:#231F20" />
</linearGradient>
<polyline class="st5" points="14.9,151.9 21.5,142.1 78.5,142.1 85.9,151.9 14.9,151.9 " />
<linearGradient id="SVGID_10_" gradientUnits="userSpaceOnUse" x1="-4094.2314" y1="1633.9298" x2="-4094.2314" y2="1571.3958" gradientTransform="matrix(0 1 1 0 -1547.031 4095.8813)">
<stop offset="0.1828" style="stop-color:#96999B" />
<stop offset="0.5608" style="stop-color:#A1A3A6" />
<stop offset="0.957" style="stop-color:#A6A8AB" />
</linearGradient>
<polygon class="st6" points="3.5,3.3 3.5,0 97.5,0 97.5,3.3 " />
<linearGradient id="SVGID_11_" gradientUnits="userSpaceOnUse" x1="50.4" y1="219.3384" x2="50.4" y2="213.8274" gradientTransform="matrix(1 0 0 -1 0 231.2)">
<stop offset="0.457" style="stop-color:#48484A" />
<stop offset="0.8495" style="stop-color:#898B8D" />
<stop offset="0.9677" style="stop-color:#48484A" />
</linearGradient>
<polygon class="st7" points="21.5,25.6 14.9,19.9 14.9,14.2 85.9,14.2 85.9,19.3 78.5,25.6 " />
<linearGradient id="SVGID_12_" gradientUnits="userSpaceOnUse" x1="50.5" y1="232.7484" x2="50.5" y2="214.6539" gradientTransform="matrix(1 0 0 -1 0 231.2)">
<stop offset="1.612903e-02" style="stop-color:#E6E7E8" />
<stop offset="0.4194" style="stop-color:#B9BBBD" />
<stop offset="1" style="stop-color:#4A4A4C" />
</linearGradient>
<polygon class="st8" points="3.5,3.3 14.9,14.7 86.1,14.7 97.5,3.4 " />
<g>
<image style="overflow:visible;opacity:0.75;enable-background:new ;" width="42" height="35" transform="matrix(1 0 0 1 29 3.9)">
</image>
<g>
<linearGradient id="SVGID_13_" gradientUnits="userSpaceOnUse" x1="44.0384" y1="210.2" x2="55.9487" y2="210.2" gradientTransform="matrix(1 0 0 -1 0 231.2)">
<stop offset="0" style="stop-color:#E5E2DF" />
<stop offset="0" style="stop-color:#D9D4D0" />
<stop offset="0" style="stop-color:#CCC6C1" />
<stop offset="6.668396e-02" style="stop-color:#BDB8B4" />
<stop offset="0.1461" style="stop-color:#A6A29F" />
<stop offset="0.5" style="stop-color:#FFFFFF" />
<stop offset="0.5796" style="stop-color:#F1F1F0" />
<stop offset="0.7315" style="stop-color:#CDCBC9" />
<stop offset="0.8764" style="stop-color:#A6A29F" />
<stop offset="1" style="stop-color:#D0D2D3" />
<stop offset="1" style="stop-color:#A6A8AB" />
</linearGradient>
<ellipse class="st9" cx="50" cy="21" rx="6" ry="2" />
</g>
</g>
</g>
<g id="LeftDoor_2_" class="st10">
<g id="RightDoor_2_" class="st11">
<g>
<g>
<g>
<g>
<g>
<g>
<g>
<defs>
<rect id="SVGID_14_" x="14.8" y="14.7" width="35.5" height="137.2" />
</defs>
<clipPath id="SVGID_15_">
<use xlink:href="#SVGID_14_" style="overflow:visible;" />
</clipPath>
<linearGradient id="SVGID_16_" gradientUnits="userSpaceOnUse" x1="-1020.2736" y1="-925.5911" x2="-947.7736" y2="-925.5911" gradientTransform="matrix(1 0 0 1 1035.0736 1008.1411)">
<stop offset="2.688172e-02" style="stop-color:#5A5B5D" />
<stop offset="0.2742" style="stop-color:#CACCCE" />
<stop offset="0.439" style="stop-color:#C8CACC" />
<stop offset="0.5121" style="stop-color:#C1C3C5" />
<stop offset="0.5215" style="stop-color:#C0C1C3" />
<stop offset="0.6609" style="stop-color:#C2C3C5" />
<stop offset="0.7111" style="stop-color:#C8CACC" />
<stop offset="0.7204" style="stop-color:#CACCCE" />
<stop offset="0.7608" style="stop-color:#C1C2C4" />
<stop offset="0.8282" style="stop-color:#A7A9AB" />
<stop offset="0.9138" style="stop-color:#7E7F81" />
<stop offset="0.9785" style="stop-color:#5A5B5D" />
</linearGradient>
<polygon class="st12" points="87.3,151.9 14.8,151.9 14.8,13.2 87.3,13.2 " />
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
<rect x="50.2" y="14.7" class="st13" width="0.3" height="137.2" />
</g>
<g id="RightDoor" class="st10">
<g id="RightDoor_1_" class="st11">
<g>
<g>
<g>
<g>
<g>
<g>
<g>
<defs>
<rect id="SVGID_17_" x="50.3" y="14.7" width="35.6" height="137.2" />
</defs>
<clipPath id="SVGID_18_">
<use xlink:href="#SVGID_17_" style="overflow:visible;" />
</clipPath>
<linearGradient id="SVGID_19_" gradientUnits="userSpaceOnUse" x1="-1806.9736" y1="-925.5911" x2="-1734.4736" y2="-925.5911" gradientTransform="matrix(-1 0 0 1 -1721.0736 1008.1411)">
<stop offset="2.688172e-02" style="stop-color:#5A5B5D" />
<stop offset="0.2742" style="stop-color:#CACCCE" />
<stop offset="0.439" style="stop-color:#C8CACC" />
<stop offset="0.5121" style="stop-color:#C1C3C5" />
<stop offset="0.5215" style="stop-color:#C0C1C3" />
<stop offset="0.6609" style="stop-color:#C2C3C5" />
<stop offset="0.7111" style="stop-color:#C8CACC" />
<stop offset="0.7204" style="stop-color:#CACCCE" />
<stop offset="0.7608" style="stop-color:#C1C2C4" />
<stop offset="0.8282" style="stop-color:#A7A9AB" />
<stop offset="0.9138" style="stop-color:#7E7F81" />
<stop offset="0.9785" style="stop-color:#5A5B5D" />
</linearGradient>
<polygon class="st14" points="13.4,13.2 85.9,13.2 85.9,151.9 13.4,151.9 " />
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
<rect x="50.2" y="14.7" class="st13" width="0.3" height="137.2" />
</g>
<g id="LeftBar">
<linearGradient id="SVGID_20_" gradientUnits="userSpaceOnUse" x1="9.2" y1="258.4245" x2="9.2" y2="186.5748" gradientTransform="matrix(1 0 0 -1 0 231.2)">
<stop offset="0.7527" style="stop-color:#616264" />
<stop offset="1" style="stop-color:#898B8D" />
</linearGradient>
<polygon class="st15" points="3.5,3.3 14.9,14.7 14.9,151.9 3.5,151.9 " />
<linearGradient id="SVGID_21_" gradientUnits="userSpaceOnUse" x1="1.9" y1="214.1236" x2="1.9" y2="112.9763" gradientTransform="matrix(1 0 0 -1 0 231.2)">
<stop offset="0.1828" style="stop-color:#87898B" />
<stop offset="0.5404" style="stop-color:#7D7F81" />
<stop offset="0.957" style="stop-color:#797B7D" />
</linearGradient>
<rect x="0.2" class="st16" width="3.4" height="151.9" />
</g>
<g id="RightBar">
<linearGradient id="SVGID_22_" gradientUnits="userSpaceOnUse" x1="-5440.8267" y1="258.4242" x2="-5440.8267" y2="186.5752" gradientTransform="matrix(-0.8862 0 0 -1 -4729.9604 231.2)">
<stop offset="0.7527" style="stop-color:#616264" />
<stop offset="1" style="stop-color:#898B8D" />
</linearGradient>
<polygon class="st17" points="97.5,3.3 85.9,14.7 85.9,151.9 97.5,151.9 " />
<linearGradient id="SVGID_23_" gradientUnits="userSpaceOnUse" x1="99.2" y1="214.1236" x2="99.2" y2="112.9763" gradientTransform="matrix(1 0 0 -1 0 231.2)">
<stop offset="0.2043" style="stop-color:#77787B" />
<stop offset="0.5796" style="stop-color:#6B6C6F" />
<stop offset="0.957" style="stop-color:#67686B" />
</linearGradient>
<rect x="97.5" class="st18" width="3.4" height="151.9" />
</g>
</g>
</g>
</svg>
</div>
<button id="up">Up</button>
<button id="down">Down</button>
</button>

Resources