How to animate fill in a linear-gradient for svg? - html
How can I animate the fill for gradient colors in SVG? I want the fill to operate from opacity 0 to opacity of 1.
.header-anim {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
#logo-anim path:nth-child(1) {
stroke-dasharray: 1032;
stroke-dashoffset: 1032;
animation: line-anim 2s ease forwards, fill-black 0.5s ease forwards 2s;
}
#logo-anim path:nth-child(2) {
stroke-dasharray: 1056;
stroke-dashoffset: 1056;
animation: line-anim 2s ease forwards, fill-gradient 0.5s ease forwards 2s;
}
#keyframes line-anim {
to {
stroke-dashoffset: 0;
}
}
#keyframes fill-black {
from {
fill: transparent;
}
to {
fill: black;
}
}
#keyframes fill-gradient {
from {
fill: transparent;
}
to {
fill: url(#paint0_linear_0_1);
}
}
<div class="header-anim">
<svg id="logo-anim" width="234" height="233" viewBox="0 0 234 233" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M75.4995 83.1013L104.5 52.7419V149.908C103.841 155.213 101.512 163.152 96.6892 169.739C91.8749 176.315 84.6232 181.5 73.9995 181.5H22.7751C7.00798 158.997 -14.2991 102.251 23.2132 49.8815C28.6996 42.432 39.475 31.0305 53.8821 21.2016C68.2922 11.3708 86.2418 3.17637 106.088 1.99737C153.179 -0.800073 186.647 23.6983 201.465 38.5H185.579C179.439 32.991 168.434 25.3772 154.676 19.7975C140.599 14.0886 123.543 10.47 105.813 13.5101C86.2158 15.0713 42.0989 30.215 20.6414 78.3625C13.4533 92.9381 5.42859 131.796 29.7138 172.272L30.9052 174.257L32.2302 172.358L46.7825 151.5H61.9399C64.1719 151.674 67.4856 151.286 70.3053 149.49C73.2521 147.614 75.4995 144.295 75.4995 139V83.1013Z" stroke="black" stroke-width="3" />
<path d="M73.0043 222.051C57.832 216.175 42.4098 206.947 31.499 193H47.399C57.5515 202.587 82.9475 219.5 114 219.5C134.223 219.5 176.537 213.946 203.746 173.335L203.755 173.322L203.763 173.309C216.107 154.033 233.106 104.05 202.245 58.1629L201.228 56.6509L199.939 57.9393L177.879 80H162.148C159.838 79.5594 156.458 79.7889 153.599 81.9385C150.614 84.1823 148.5 88.2825 148.5 95V149.392L119.5 179.298V83.5C119.5 77.8938 121.122 69.4609 125.935 62.4762C130.694 55.5707 138.617 50 151.5 50H210.265C225.204 69.4906 246.888 120.188 217.2 171.752C187.163 223.922 135.874 232.968 114.135 231.006L114.094 231.002L114.052 231.001C104.628 230.673 89.0193 228.254 73.0043 222.051Z" stroke="url(#paint0_linear_0_1)" stroke-width="3" />
<defs>
<linearGradient
id="paint0_linear_0_1"
x1="131.003"
y1="48.5"
x2="131.003"
y2="232.748"
gradientUnits="userSpaceOnUse">
<stop stop-color="#A77027" />
<stop offset="0.53125" stop-color="#F1E189" />
<stop offset="1" stop-color="#A77027" />
</linearGradient>
</defs>
</svg>
</div>
codepen link for reproduced error.
Currently the gradient fill just snap into existence instead of slowly fading in like black fill. How can I achieve this animation? Thank you
You can't animate in "paint" fills, such as gradients, like you can with colours.
What you can do instead is animate the fill-opacity. And in fact it actually simplifies the SVG. Because use can use the same fill animation for both paths.
.header-anim {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
#logo-anim path:nth-child(1) {
stroke-dasharray: 1032;
stroke-dashoffset: 1032;
fill: black;
fill-opacity: 0;
animation: line-anim 2s ease forwards, fill-anim 0.5s ease forwards 2s;
}
#logo-anim path:nth-child(2) {
stroke-dasharray: 1056;
stroke-dashoffset: 1056;
fill: url(#paint0_linear_0_1);
fill-opacity: 0;
animation: line-anim 2s ease forwards, fill-anim 0.5s ease forwards 2s;
}
#keyframes line-anim {
to {
stroke-dashoffset: 0;
}
}
#keyframes fill-anim {
from {
fill-opacity: 0;
}
to {
fill-opacity: 1;
}
}
<div class="header-anim">
<svg id="logo-anim" width="234" height="233" viewBox="0 0 234 233" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M75.4995 83.1013L104.5 52.7419V149.908C103.841 155.213 101.512 163.152 96.6892 169.739C91.8749 176.315 84.6232 181.5 73.9995 181.5H22.7751C7.00798 158.997 -14.2991 102.251 23.2132 49.8815C28.6996 42.432 39.475 31.0305 53.8821 21.2016C68.2922 11.3708 86.2418 3.17637 106.088 1.99737C153.179 -0.800073 186.647 23.6983 201.465 38.5H185.579C179.439 32.991 168.434 25.3772 154.676 19.7975C140.599 14.0886 123.543 10.47 105.813 13.5101C86.2158 15.0713 42.0989 30.215 20.6414 78.3625C13.4533 92.9381 5.42859 131.796 29.7138 172.272L30.9052 174.257L32.2302 172.358L46.7825 151.5H61.9399C64.1719 151.674 67.4856 151.286 70.3053 149.49C73.2521 147.614 75.4995 144.295 75.4995 139V83.1013Z" stroke="black" stroke-width="3" />
<path id="path-with-grad" d="M73.0043 222.051C57.832 216.175 42.4098 206.947 31.499 193H47.399C57.5515 202.587 82.9475 219.5 114 219.5C134.223 219.5 176.537 213.946 203.746 173.335L203.755 173.322L203.763 173.309C216.107 154.033 233.106 104.05 202.245 58.1629L201.228 56.6509L199.939 57.9393L177.879 80H162.148C159.838 79.5594 156.458 79.7889 153.599 81.9385C150.614 84.1823 148.5 88.2825 148.5 95V149.392L119.5 179.298V83.5C119.5 77.8938 121.122 69.4609 125.935 62.4762C130.694 55.5707 138.617 50 151.5 50H210.265C225.204 69.4906 246.888 120.188 217.2 171.752C187.163 223.922 135.874 232.968 114.135 231.006L114.094 231.002L114.052 231.001C104.628 230.673 89.0193 228.254 73.0043 222.051Z" stroke="url(#paint0_linear_0_1)" stroke-width="3" />
<defs>
<linearGradient
id="paint0_linear_0_1"
x1="131.003"
y1="48.5"
x2="131.003"
y2="232.748"
gradientUnits="userSpaceOnUse">
<stop stop-color="#A77027" />
<stop offset="0.53125" stop-color="#F1E189" />
<stop offset="1" stop-color="#A77027" />
</linearGradient>
</defs>
</svg>
</div>
Related
HTML SVG reduce circle size
I have found animated circle made with svg but I need to reduce the circle size How can I modify the code please? #keyframes dash { from { stroke-dashoffset: 816; } to { stroke-dashoffset: 0; } } .progress-circle path { stroke-dasharray: 816; stroke-dashoffset: 0; animation: dash 2s linear; animation-delay: 0.3s; } <svg class="progress-circle" width="70" height="70"> <path d="m35,2.5c17.955803,0 32.5,14.544199 32.5,32.5c0,17.955803 -14.544197,32.5 -32.5,32.5c-17.955803,0 -32.5,-14.544197 -32.5,-32.5c0,-17.955801 14.544197,-32.5 32.5,-32.5z" stroke="#000" stroke-width="1" fill="transparent" /> </svg>
You need to change the width and height and then add the viewbox atrribute with the original size: #keyframes dash { from { stroke-dashoffset: 816; } to { stroke-dashoffset: 0; } } .progress-circle path { stroke-dasharray: 816; stroke-dashoffset: 0; animation: dash 2s linear; animation-delay: 0.3s; } <svg class="progress-circle" width="30" height="30" viewBox="0 0 70 70"> <path d="m35,2.5c17.955803,0 32.5,14.544199 32.5,32.5c0,17.955803 -14.544197,32.5 -32.5,32.5c-17.955803,0 -32.5,-14.544197 -32.5,-32.5c0,-17.955801 14.544197,-32.5 32.5,-32.5z" stroke="#000" stroke-width="1" fill="transparent" /> </svg>
add viewBox= "0 0 50 50" in svg tag and reduce svgwidth and height
Using linear-gradient in an animation on CSS
I'm working on a mobile first project, it's a project on with HTML and CSS only, allowing us to learn how to do animation with CSS only. I have a problem with my project that I hope you can help me with. I am trying to fill the hearts with a linear-gradient color instead of the ##9356DC I am using in my code. Problem is, each time I am using the linear-gradient, the heart doesn't fill with any color anymore. Thanks in advance for all the help you can provide to me! .icon { fill: transparent; stroke: black; stroke-width: 50; cursor: pointer; position: absolute; right: 1.5rem; bottom: 2rem; } .icon svg { overflow: visible; width: 1.6rem; } .icon .heart-main:active path { animation: fill-animation 1.5s ease-in-out forwards; stroke: #9356DC; } #keyframes fill-animation { 10% { fill: #9356DC; } 80% { fill: #9356DC; } 100% { fill: #9356DC; } } <div class="icon"> <svg class="heart-main" viewBox="0 0 512 512" width="100" title="heart"> <path d="M462.3 62.6C407.5 15.9 326 24.3 275.7 76.2L256 96.5l-19.7-20.3C186.1 24.3 104.5 15.9 49.7 62.6c-62.8 53.6-66.1 149.8-9.9 207.9l193.5 199.8c12.5 12.9 32.8 12.9 45.3 0l193.5-199.8c56.3-58.1 53-154.3-9.8-207.9z" /> </svg> </div>
To fill linear-gradient, you will have to add linearGradient node inside the definitions section of your SVG file like below: (Read More about Linear Gradient) <defs> <linearGradient id="FillGradient" gradientTransform="rotate(90)"> <stop offset="2%" stop-color="#FFF" /> <stop offset="95%" stop-color="#9356DC" /> </linearGradient> </defs> Make sure you are adding id attribute which is going to be used in CSS to fill the gradient like below: #keyframes fill-animation { 0%{ fill-opacity: 0.1; } 10% { fill: url(#FillGradient); fill-opacity: 0.1; } 80% { fill: url(#FillGradient); fill-opacity: 1; } 100% { fill: url(#FillGradient); fill-opacity: 1; } } You can remove the fill-opacity and of course change the color of gradient in linearGradient node as per your need. See the working Snippet below: (I have commented few styles just to make it big and clear) .icon { fill: transparent; stroke: black; stroke-width: 50; cursor: pointer; /* position: absolute; right: 1.5rem; bottom: 2rem;*/ } .icon svg { overflow: visible; width: 5.6rem; /* changed from 1.6 to 5.6 */ } .icon .heart-main:active path { animation: fill-animation 1.5s ease-in-out forwards; stroke: #9356DC; } #keyframes fill-animation { 0%{ fill-opacity: 0.1; } 10% { fill: url(#FillGradient); fill-opacity: 0.1; } 80% { fill: url(#FillGradient); fill-opacity: 1; } 100% { fill: url(#FillGradient); fill-opacity: 1; } } <div class="icon"> <svg class="heart-main" viewBox="0 0 512 512" width="300" title="heart"> <path d="M462.3 62.6C407.5 15.9 326 24.3 275.7 76.2L256 96.5l-19.7-20.3C186.1 24.3 104.5 15.9 49.7 62.6c-62.8 53.6-66.1 149.8-9.9 207.9l193.5 199.8c12.5 12.9 32.8 12.9 45.3 0l193.5-199.8c56.3-58.1 53-154.3-9.8-207.9z" /> <defs> <linearGradient id="FillGradient" gradientTransform="rotate(90)"> <stop offset="2%" stop-color="#FFF" /> <stop offset="98%" stop-color="#9356DC" /> </linearGradient> </defs> </svg> </div>
you could use my code #keyframes value { 0%{background-image: linear-gradient(90deg, red, purple, green);} 25%{background-image: linear-gradient(90deg, orange, yellow,blue);} 50%{background-image: linear-gradient(90deg, black, grey, white);} 100%{background-image: linear-gradient(90deg,lime,violet,magenta);} } then use .icon{ animation-name: value; animation-duration: 50s; animation-iteration-count: infinite; } you could use background-image instead of fill and if that doesn't work you could use color instead. i hope i helped but i am pretty new to css myself.
How can I cut a hole in an SVG, making every <path> that goes over that hole transparent
Considering the following example: path { transform-origin: 50% 0%; } #keyframes path0 { 0% { transform: rotate(-10deg); } 100% { transform: rotate(10deg); } } #keyframes path1 { 0% { transform: rotate(-30deg); } 100% { transform: rotate(30deg); } } #keyframes path2 { 0% { transform: rotate(40deg); } 100% { transform: rotate(-40deg); } } .background--custom { height: 100%; width: 100%; background-color: red; } <svg class="background--custom" id="demo" viewBox="0 0 100 100" preserveAspectRatio="none"> <path fill="#D6D6D6" fill-opacity="1" d="M-100 -100L200 -100L200 50L-100 50Z" style="animation: path0 5s linear infinite alternate;" /> <path fill="#DEFFFF" fill-opacity="1" d="M-100 -100L200 -100L200 50L-100 50Z" style="animation: path1 5s linear infinite alternate;" /> <path fill="#DAFFF5" fill-opacity="1" d="M-100 -100L200 -100L200 20L-100 20Z" style="animation: path2 5s linear infinite alternate;" /> </svg> This creates an animates SVG background. It looks like this: Its simply a few lines that rotate. The goal is to cut a rectangle hole in the whole SVG, causing a section of the SVG to be transparent. Considering the black rectangle would be the hole, it should look something like this: Is this in any way possible? I have tried using mask elements but I dont see how I can apply those mask elements to the whole SVG and not just single path element.
Here I made a <mask> on a <g> element that has a white <rect> in the background and a black <rect> in the foreground. The black square makes the group transparent. The result is that you can see the red color in the background -- I don't know if that was the point? path { transform-origin: 50% 0%; } #keyframes path0 { 0% { transform: rotate(-10deg); } 100% { transform: rotate(10deg); } } #keyframes path1 { 0% { transform: rotate(-30deg); } 100% { transform: rotate(30deg); } } #keyframes path2 { 0% { transform: rotate(40deg); } 100% { transform: rotate(-40deg); } } .background--custom { height: 100%; width: 100%; background-color: red; } <svg class="background--custom" id="demo" viewBox="0 0 100 100" preserveAspectRatio="none"> <defs> <mask id="mask01"> <rect width="100" height="100" fill="white"/> <rect width="60" height="60" x="20" y="40" fill="black"/> </mask> </defs> <g mask="url(#mask01)"> <path fill="#D6D6D6" fill-opacity="1" d="M-100 -100L200 -100L200 50L-100 50Z" style="animation: path0 5s linear infinite alternate;" /> <path fill="#DEFFFF" fill-opacity="1" d="M-100 -100L200 -100L200 50L-100 50Z" style="animation: path1 5s linear infinite alternate;" /> <path fill="#DAFFF5" fill-opacity="1" d="M-100 -100L200 -100L200 20L-100 20Z" style="animation: path2 5s linear infinite alternate;" /> </g> </svg>
SVG arrow wrong sync animation
why doesn't the arrow start along with the line? Is it not synchronized? I would like the arrow to leave together with the line. .box{ width:100%; padding:0px; background-color: black; } .squiggle { stroke-dasharray: 498.181; stroke-dashoffset: 498.181; animation: draw 10s linear infinite; } #keyframes draw { from { stroke-dashoffset: 498.181; } to { stroke-dashoffset: 0; } } <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=5"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <body> <div class="box"> <svg xmlns="http://www.w3.org/2000/svg" id="svg1" viewBox="0 0 215 66" preserveAspectRatio="xMidYMid meet"> <g id="layer1" transform="translate(-68.19229,10.180375)"> <g id="g38" transform="matrix(0.26458333,0,0,0.26458333,54.727655,-107.07271)"> <g> <path id="path22" class="squiggle" style="fill:none; stroke:orange; stroke-width:3px; stroke-linecap:butt; stroke-linejoin:miter; stroke-opacity:1" d="M 653.40952,459.58095 C 539.70759,242.15840999999995 379.43686,703.6978899999999 252.34286,526.62857"/> <use href="#path22"/> <path fill="red" d="M -9.5357143,-9.9107143 10,0 -10,10 -3.3928571,-0.17857143 Z"> <animateMotion dur="10s" repeatCount="indefinite" rotate="auto"> <mpath href="#path22"/> </animateMotion> </path> </g> </g> </g> </svg> </div> </body> </html>
look at this, This may be helpful: #desc { max-width: 700px; margin-top: 100px; color: #b3b3b3; font-size: 11px; font-family: sans-serif; } #desc li { margin-bottom: 1em; } #desc p { padding: 20px 0 0 40px; } #doubled-separate { width: 110px; } #doubled-separate #over-path { fill: none; stroke-dasharray: 150; stroke-dashoffset: 0; animation: 10s reveal linear infinite forwards; } #keyframes reveal { 50%, 100% { stroke-dashoffset: 150; } } #separate-marker { width: 88px; position: relative; top:-4px; } #separate-marker .just-line { fill: none; stroke-dashoffset: 0; animation: 10s reveal2 linear infinite forwards; } #keyframes reveal2 { 100% { stroke-dashoffset: 150; } } #doubled-separate-marker { width: 110px; } #doubled-separate-marker .over-path { fill: none; stroke-dasharray: 150; stroke-dashoffset: 0; animation: 3s reveal3 linear infinite forwards; } #keyframes reveal3 { 50%, 100% { stroke-dashoffset: 150; } } #doubled-separate-marker-2 { width: 110px; } #doubled-separate-marker-2 #arrow3 path { opacity: 0; animation: 10s revealarrow linear infinite forwards; } #keyframes revealarrow { 0%, 50% { opacity: 0; } 60%, 100% { opacity: 1; } } #doubled-separate-marker-2 .over-path { fill: none; stroke-dasharray: 150; stroke-dashoffset: 0; animation: 10s reveal4 linear infinite forwards; } #keyframes reveal4 { 50%, 100% { stroke-dashoffset: 150; } } #separate-marker-2 { width: 88px; position: relative; top:-4px; } <svg viewBox="0 0 44 97" preserveAspectRatio="xMinYMin meet" id="separate-marker-2"> <defs> <marker id="arrow4" viewBox="0 0 13 13" refX="11" refY="8" markerWidth="13" markerHeight="13" markerUnits="userSpaceOnUse" orient="auto-start-reverse" preserveAspectRatio="xMinYMin meet"> <path d="M3.66332316,0.125850427 L3.75090984,0.194245468 L12.2529105,7.89856961 C12.6592041,8.26674392 12.5414228,8.91869993 12.063138,9.1358919 L11.9627228,9.17332054 L0.963626457,12.4383634 C0.566538833,12.5562375 0.149079906,12.3298902 0.0312058479,11.9328025 C-0.0768453724,11.5688056 0.10434498,11.187691 0.441152309,11.0359066 L0.536766731,11.0003819 L10.2568836,8.11360225 L2.74367477,1.30576583 C2.46464034,1.05291103 2.41998014,0.63794112 2.62313708,0.333974789 L2.69153212,0.246388115 C2.94438692,-0.0326463148 3.35935683,-0.0773065179 3.66332316,0.125850427 L3.66332316,0.125850427 Z" fill="#B3B3B3" fill-rule="nonzero"></path> </marker> </defs> <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g transform="translate(1.000000, 1.000000)"> <path d="M31.6194299,0 C-0.925516514,8.99255645 -7.90071768,47.4229255 8.63466801,71.535115 C9.41568622,72.6740094 10.2491558,73.7809605 11.1348599,74.8513572" class="just-line" stroke="#B3B3B3" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="4" marker-end="url(#arrow4)"> <animate attributeName="d" from="M31.6194299,0 C-0.925516514,8.99255645 -7.90071768,47.4229255 8.63466801,71.535115 C9.41568622,72.6740094 10.2491558,73.7809605 11.1348599,74.8513572" to="M31.6194299,0 C-0.925516514,8.99255645 -7.90071768,47.4229255 8.63466801,71.535115 C15.4626235,81.4917594 26.2993953,89.006995 41,91" dur="1.5s" repeatCount="indefinite"/> </path> </g> </g> </svg> <div id="desc"> <ol> <li>Line and arrowhead are two paths grouped together, with an identical (but wide and white) line path on top that animates to reveal.</li> <li>Line path with arrowhead path attached as a marker. dash-offset animates on line path to add movement.</li> <li>Fusion of 1 and 2. Line path with arrowhead as marker, white line path animating on top. Shows that path+marker connection is much smoother than path+path, and that butt linecaps create a smoother animation finish than square or round (although it required moving the white path start-point a step or two to cover the marker).</li> <!-- figuring out CSS animation on an SVG marker was a JOURNEY --> <li>Adaptation of 3. The arrowhead SVG marker has CSS animation applied. Since it doesn't appear until after the line path is fully visible, the white line path on top has a narrower stroke since it doesn't need to cover the marker. The animation timings are synced up via keyframe percentages.</li> <li>native SVG animate!</li> </ol> <p>DISCLAIMER: honestly no idea about browser support for any of this</p> </div>
Animation delay in SVG not respected
I want to make appear up some currency, this is the code: #keyframes appearUp { 0% { opacity: 1; transform: translate3d(0, 5px, 0); } 100% { transform: translate3d(0, -5px, 0); } } #currency-usd, #currency-euro, #currency-pound { opacity: 0; } #currency-usd { animation: appearUp 5s ease-out 0s infinite; } #currency-euro { animation: appearUp 5s ease-out 5s infinite; } #currency-pound { animation: appearUp 5s ease-out 10s infinite; } <svg id="city-total-v2" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve"> <g id="Roundblockcurrency"> <linearGradient id="SVGID_454_" gradientUnits="userSpaceOnUse" x1="379.3599" y1="466.0918" x2="379.3599" y2="508.5988"><stop offset="0" style="stop-color: rgb(124, 10, 103);"></stop><stop offset="1" style="stop-color: rgb(178, 18, 85);"></stop></linearGradient> <path fill-rule="evenodd" clip-rule="evenodd" fill="url(#SVGID_454_)" d="M352.21,531.89l0-0.05v-61.9 c12.06-11.81,31.17-21.38,54.29-28.16v61.9c-23.13,6.78-42.23,16.35-54.29,28.16L352.21,531.89L352.21,531.89z"></path> <path id="currency-usd" fill-rule="evenodd" clip-rule="evenodd" fill="#F07A28" d="M397.79,477.91c0,2-0.68,4.13-2.05,6.39 c-1.37,2.26-3.11,4.3-5.24,6.14v2.42c0,0.68-0.23,1.39-0.69,2.14c-0.46,0.75-1.03,1.35-1.72,1.79c-0.66,0.42-1.21,0.55-1.66,0.38 c-0.45-0.16-0.67-0.59-0.67-1.26v-2.18c-1.42,0.78-2.71,1.32-3.88,1.61c-1.17,0.29-2.31,0.32-3.41,0.09 c-0.71-0.17-1.06-0.63-1.06-1.38c0-0.6,0.22-1.27,0.67-2.01c0.45-0.74,0.98-1.32,1.62-1.72c0.5-0.32,0.95-0.46,1.34-0.4 c0.82,0.13,1.59,0.14,2.33,0.04c0.74-0.1,1.54-0.36,2.41-0.79v-7.6c-5.28,2.44-7.92,1.54-7.92-2.72c0-2.16,0.74-4.4,2.21-6.74 c1.47-2.34,3.38-4.42,5.72-6.23v-1.28c0-0.67,0.23-1.39,0.69-2.14c0.46-0.75,1.03-1.35,1.72-1.79c0.66-0.42,1.21-0.55,1.66-0.39 c0.45,0.17,0.67,0.59,0.67,1.26v1.44c2.23-1.05,4.07-1.43,5.52-1.14c0.76,0.1,1.14,0.55,1.14,1.33c0,0.6-0.22,1.27-0.67,2.01 c-0.45,0.74-0.97,1.31-1.58,1.7c-0.39,0.25-0.75,0.37-1.06,0.33c-0.79-0.14-1.91,0.02-3.35,0.48v7.21c2.55-1.05,4.4-1.36,5.56-0.95 C397.21,474.35,397.79,475.68,397.79,477.91L397.79,477.91z M382.49,475.65c0,0.86,0.28,1.37,0.83,1.55 c0.55,0.18,1.37,0.07,2.44-0.31v-6.47c-1.08,0.9-1.89,1.8-2.44,2.71C382.77,474.03,382.49,474.87,382.49,475.65L382.49,475.65z M390.49,485.76c0.76-0.8,1.38-1.61,1.85-2.42c0.47-0.81,0.71-1.52,0.71-2.11c0-0.73-0.21-1.22-0.63-1.48 c-0.42-0.26-1.06-0.29-1.93-0.1V485.76L390.49,485.76z"/> <path id="currency-euro" fill="#F07A28" d="M399.44,482.88c0,0.33-0.09,0.69-0.27,1.08c-0.18,0.4-0.42,0.77-0.72,1.11c-0.96,1.18-2.02,2.29-3.19,3.34 s-2.34,1.93-3.52,2.64c-3.02,1.8-5.72,2.57-8.1,2.31s-4.06-1.61-5.02-4.06l-2.3,1.38c-0.58,0.35-1.06,0.46-1.44,0.33 c-0.39-0.13-0.58-0.46-0.58-1.01s0.19-1.11,0.58-1.7c0.38-0.59,0.86-1.05,1.44-1.4l1.6-0.96c-0.03-0.29-0.04-0.76-0.04-1.42v-0.74 l-1.56,0.93c-0.58,0.35-1.06,0.45-1.44,0.33c-0.39-0.13-0.58-0.46-0.58-1.01s0.19-1.12,0.58-1.7c0.38-0.58,0.86-1.05,1.44-1.39 l2.18-1.3c0.55-2.33,1.46-4.64,2.74-6.94c1.28-2.3,2.82-4.41,4.63-6.34s3.77-3.53,5.88-4.79c1.18-0.71,2.34-1.23,3.47-1.56 c1.14-0.34,2.2-0.49,3.19-0.44c0.66-0.04,0.99,0.31,0.99,1.05c0,0.49-0.17,1.04-0.49,1.65c-0.33,0.64-0.78,1.13-1.36,1.47 c-0.38,0.23-0.75,0.35-1.11,0.38c-1.45-0.09-3.02,0.36-4.69,1.36c-2.11,1.26-3.98,2.94-5.61,5.04c-1.63,2.1-2.82,4.34-3.56,6.74 l6.62-3.92c0.58-0.35,1.06-0.45,1.44-0.33c0.38,0.13,0.58,0.45,0.58,0.97c0,0.55-0.19,1.12-0.58,1.7 c-0.38,0.59-0.86,1.05-1.44,1.4l-7.41,4.38v0.74c0,0.33,0.03,0.8,0.08,1.43l7.32-4.33c0.58-0.34,1.06-0.45,1.44-0.33 c0.38,0.13,0.58,0.45,0.58,0.97c0,0.55-0.19,1.12-0.58,1.7c-0.38,0.59-0.86,1.05-1.44,1.39l-6.38,3.81 c0.8,1.34,1.98,2.03,3.56,2.07c1.58,0.04,3.37-0.53,5.37-1.73c1.73-1.03,3.29-2.46,4.69-4.28c0.33-0.36,0.69-0.66,1.07-0.88 c0.6-0.36,1.08-0.41,1.44-0.16C399.27,482.07,399.44,482.42,399.44,482.88z"/> <path id="currency-pound" fill="#F07A28" d="M398.65,482.29c0.28,0.19,0.42,0.53,0.42,1.01c0,0.57-0.19,1.13-0.56,1.71c-0.38,0.57-0.97,1.21-1.77,1.93 c-1.08,1.04-2.26,1.9-3.55,2.57c-1,0.52-2.81,1.13-5.45,1.86c-2.42,0.64-4.06,1.18-4.92,1.63c-1.08,0.56-2.34,1.41-3.79,2.57 c-0.32,0.22-0.66,0.53-1.01,0.93c-0.48,0.47-0.83,0.76-1.05,0.87c-0.4,0.21-0.75,0.24-1.05,0.08c-0.3-0.15-0.44-0.46-0.44-0.92 c0-0.48,0.15-0.98,0.44-1.48c0.3-0.5,0.71-1,1.25-1.5c1.08-0.91,2.1-1.71,3.07-2.4c0.65-1.38,0.97-2.83,0.97-4.33 c0-1.4-0.31-2.89-0.93-4.48l-2.54,1.32c-0.51,0.26-0.93,0.32-1.27,0.15c-0.34-0.16-0.5-0.5-0.5-1.01c0-0.46,0.17-0.93,0.5-1.41 c0.34-0.48,0.76-0.86,1.27-1.12l1.53-0.79c-0.32-1.07-0.48-2.06-0.48-2.98c0-1.75,0.36-3.5,1.09-5.24 c0.73-1.75,1.77-3.35,3.15-4.82c1.37-1.46,2.99-2.68,4.84-3.64c1.24-0.64,2.42-1.08,3.55-1.32c1.13-0.24,2.08-0.23,2.86,0.01 c1.13,0.14,1.69,0.59,1.69,1.34c0,0.51-0.19,1.07-0.58,1.68c-0.39,0.61-0.85,1.05-1.39,1.33c-0.27,0.14-0.53,0.22-0.79,0.25 s-0.45-0.01-0.58-0.1c-1.24-0.68-2.81-0.52-4.72,0.47c-1.59,0.82-2.84,2-3.77,3.53c-0.93,1.53-1.39,3.05-1.39,4.55 c0,0.75,0.17,1.71,0.52,2.87l7.38-3.83c0.51-0.27,0.93-0.32,1.27-0.17c0.34,0.15,0.5,0.48,0.5,0.99c0,0.48-0.17,0.97-0.5,1.45 c-0.34,0.48-0.76,0.86-1.27,1.12l-6.29,3.26c0.56,1.4,0.85,2.63,0.85,3.68c0,1.53-0.42,3.21-1.25,5.04 c0.67-0.32,1.32-0.57,1.96-0.73s1.5-0.37,2.6-0.62c1.08-0.26,1.94-0.49,2.58-0.67c0.65-0.19,1.28-0.44,1.9-0.76 c0.51-0.27,1.05-0.64,1.63-1.13c0.58-0.49,1.07-0.96,1.47-1.41c0.51-0.59,0.98-0.99,1.41-1.22 C397.98,482.13,398.36,482.1,398.65,482.29z"/> </g> </svg> For some reason, the delay is not respected and the currency usd/euro/pound are on top of each over. Where did I fail?
The usd animation starts at 0s runs for 5s and then repeats indefinitely. The start of its second time through coincides with the start of the euro animation. So both run together. The third time through, pound starts and all three continue looping together indefinitely. You need to make sure that only one shows at a time. One way is to use the keyframes to hide the symbol and keep it hidden while the other two animate. #keyframes appearUp { 0% { opacity: 1; transform: translate(0, 5px); } 33% { opacity: 1; transform: translate(0, -5px); } 34% { opacity: 0; } } #currency-usd, #currency-euro, #currency-pound { opacity: 0; } #currency-usd { animation: appearUp 15s ease-out 0s infinite; } #currency-euro { animation: appearUp 15s ease-out 5s infinite; } #currency-pound { animation: appearUp 15s ease-out 10s infinite; } <svg id="city-total-v2" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve"> <g id="Roundblockcurrency"> <linearGradient id="SVGID_454_" gradientUnits="userSpaceOnUse" x1="379.3599" y1="466.0918" x2="379.3599" y2="508.5988"><stop offset="0" style="stop-color: rgb(124, 10, 103);"></stop><stop offset="1" style="stop-color: rgb(178, 18, 85);"></stop></linearGradient> <path fill-rule="evenodd" clip-rule="evenodd" fill="url(#SVGID_454_)" d="M352.21,531.89l0-0.05v-61.9 c12.06-11.81,31.17-21.38,54.29-28.16v61.9c-23.13,6.78-42.23,16.35-54.29,28.16L352.21,531.89L352.21,531.89z"></path> <path id="currency-usd" fill-rule="evenodd" clip-rule="evenodd" fill="#F07A28" d="M397.79,477.91c0,2-0.68,4.13-2.05,6.39 c-1.37,2.26-3.11,4.3-5.24,6.14v2.42c0,0.68-0.23,1.39-0.69,2.14c-0.46,0.75-1.03,1.35-1.72,1.79c-0.66,0.42-1.21,0.55-1.66,0.38 c-0.45-0.16-0.67-0.59-0.67-1.26v-2.18c-1.42,0.78-2.71,1.32-3.88,1.61c-1.17,0.29-2.31,0.32-3.41,0.09 c-0.71-0.17-1.06-0.63-1.06-1.38c0-0.6,0.22-1.27,0.67-2.01c0.45-0.74,0.98-1.32,1.62-1.72c0.5-0.32,0.95-0.46,1.34-0.4 c0.82,0.13,1.59,0.14,2.33,0.04c0.74-0.1,1.54-0.36,2.41-0.79v-7.6c-5.28,2.44-7.92,1.54-7.92-2.72c0-2.16,0.74-4.4,2.21-6.74 c1.47-2.34,3.38-4.42,5.72-6.23v-1.28c0-0.67,0.23-1.39,0.69-2.14c0.46-0.75,1.03-1.35,1.72-1.79c0.66-0.42,1.21-0.55,1.66-0.39 c0.45,0.17,0.67,0.59,0.67,1.26v1.44c2.23-1.05,4.07-1.43,5.52-1.14c0.76,0.1,1.14,0.55,1.14,1.33c0,0.6-0.22,1.27-0.67,2.01 c-0.45,0.74-0.97,1.31-1.58,1.7c-0.39,0.25-0.75,0.37-1.06,0.33c-0.79-0.14-1.91,0.02-3.35,0.48v7.21c2.55-1.05,4.4-1.36,5.56-0.95 C397.21,474.35,397.79,475.68,397.79,477.91L397.79,477.91z M382.49,475.65c0,0.86,0.28,1.37,0.83,1.55 c0.55,0.18,1.37,0.07,2.44-0.31v-6.47c-1.08,0.9-1.89,1.8-2.44,2.71C382.77,474.03,382.49,474.87,382.49,475.65L382.49,475.65z M390.49,485.76c0.76-0.8,1.38-1.61,1.85-2.42c0.47-0.81,0.71-1.52,0.71-2.11c0-0.73-0.21-1.22-0.63-1.48 c-0.42-0.26-1.06-0.29-1.93-0.1V485.76L390.49,485.76z"/> <path id="currency-euro" fill="#F07A28" d="M399.44,482.88c0,0.33-0.09,0.69-0.27,1.08c-0.18,0.4-0.42,0.77-0.72,1.11c-0.96,1.18-2.02,2.29-3.19,3.34 s-2.34,1.93-3.52,2.64c-3.02,1.8-5.72,2.57-8.1,2.31s-4.06-1.61-5.02-4.06l-2.3,1.38c-0.58,0.35-1.06,0.46-1.44,0.33 c-0.39-0.13-0.58-0.46-0.58-1.01s0.19-1.11,0.58-1.7c0.38-0.59,0.86-1.05,1.44-1.4l1.6-0.96c-0.03-0.29-0.04-0.76-0.04-1.42v-0.74 l-1.56,0.93c-0.58,0.35-1.06,0.45-1.44,0.33c-0.39-0.13-0.58-0.46-0.58-1.01s0.19-1.12,0.58-1.7c0.38-0.58,0.86-1.05,1.44-1.39 l2.18-1.3c0.55-2.33,1.46-4.64,2.74-6.94c1.28-2.3,2.82-4.41,4.63-6.34s3.77-3.53,5.88-4.79c1.18-0.71,2.34-1.23,3.47-1.56 c1.14-0.34,2.2-0.49,3.19-0.44c0.66-0.04,0.99,0.31,0.99,1.05c0,0.49-0.17,1.04-0.49,1.65c-0.33,0.64-0.78,1.13-1.36,1.47 c-0.38,0.23-0.75,0.35-1.11,0.38c-1.45-0.09-3.02,0.36-4.69,1.36c-2.11,1.26-3.98,2.94-5.61,5.04c-1.63,2.1-2.82,4.34-3.56,6.74 l6.62-3.92c0.58-0.35,1.06-0.45,1.44-0.33c0.38,0.13,0.58,0.45,0.58,0.97c0,0.55-0.19,1.12-0.58,1.7 c-0.38,0.59-0.86,1.05-1.44,1.4l-7.41,4.38v0.74c0,0.33,0.03,0.8,0.08,1.43l7.32-4.33c0.58-0.34,1.06-0.45,1.44-0.33 c0.38,0.13,0.58,0.45,0.58,0.97c0,0.55-0.19,1.12-0.58,1.7c-0.38,0.59-0.86,1.05-1.44,1.39l-6.38,3.81 c0.8,1.34,1.98,2.03,3.56,2.07c1.58,0.04,3.37-0.53,5.37-1.73c1.73-1.03,3.29-2.46,4.69-4.28c0.33-0.36,0.69-0.66,1.07-0.88 c0.6-0.36,1.08-0.41,1.44-0.16C399.27,482.07,399.44,482.42,399.44,482.88z"/> <path id="currency-pound" fill="#F07A28" d="M398.65,482.29c0.28,0.19,0.42,0.53,0.42,1.01c0,0.57-0.19,1.13-0.56,1.71c-0.38,0.57-0.97,1.21-1.77,1.93 c-1.08,1.04-2.26,1.9-3.55,2.57c-1,0.52-2.81,1.13-5.45,1.86c-2.42,0.64-4.06,1.18-4.92,1.63c-1.08,0.56-2.34,1.41-3.79,2.57 c-0.32,0.22-0.66,0.53-1.01,0.93c-0.48,0.47-0.83,0.76-1.05,0.87c-0.4,0.21-0.75,0.24-1.05,0.08c-0.3-0.15-0.44-0.46-0.44-0.92 c0-0.48,0.15-0.98,0.44-1.48c0.3-0.5,0.71-1,1.25-1.5c1.08-0.91,2.1-1.71,3.07-2.4c0.65-1.38,0.97-2.83,0.97-4.33 c0-1.4-0.31-2.89-0.93-4.48l-2.54,1.32c-0.51,0.26-0.93,0.32-1.27,0.15c-0.34-0.16-0.5-0.5-0.5-1.01c0-0.46,0.17-0.93,0.5-1.41 c0.34-0.48,0.76-0.86,1.27-1.12l1.53-0.79c-0.32-1.07-0.48-2.06-0.48-2.98c0-1.75,0.36-3.5,1.09-5.24 c0.73-1.75,1.77-3.35,3.15-4.82c1.37-1.46,2.99-2.68,4.84-3.64c1.24-0.64,2.42-1.08,3.55-1.32c1.13-0.24,2.08-0.23,2.86,0.01 c1.13,0.14,1.69,0.59,1.69,1.34c0,0.51-0.19,1.07-0.58,1.68c-0.39,0.61-0.85,1.05-1.39,1.33c-0.27,0.14-0.53,0.22-0.79,0.25 s-0.45-0.01-0.58-0.1c-1.24-0.68-2.81-0.52-4.72,0.47c-1.59,0.82-2.84,2-3.77,3.53c-0.93,1.53-1.39,3.05-1.39,4.55 c0,0.75,0.17,1.71,0.52,2.87l7.38-3.83c0.51-0.27,0.93-0.32,1.27-0.17c0.34,0.15,0.5,0.48,0.5,0.99c0,0.48-0.17,0.97-0.5,1.45 c-0.34,0.48-0.76,0.86-1.27,1.12l-6.29,3.26c0.56,1.4,0.85,2.63,0.85,3.68c0,1.53-0.42,3.21-1.25,5.04 c0.67-0.32,1.32-0.57,1.96-0.73s1.5-0.37,2.6-0.62c1.08-0.26,1.94-0.49,2.58-0.67c0.65-0.19,1.28-0.44,1.9-0.76 c0.51-0.27,1.05-0.64,1.63-1.13c0.58-0.49,1.07-0.96,1.47-1.41c0.51-0.59,0.98-0.99,1.41-1.22 C397.98,482.13,398.36,482.1,398.65,482.29z"/> </g> </svg>