CSS animation rendering - staggering - css
I have created this CodePen for a rotating border around a button and although the principle seems to be good, it is not working as it should - the rendering seems extremely slow and staggering (I have the M1 MacBook Pro).
.button {
width: 206px;
height: 70px;
line-height: 70px;
text-align: center;
position: relative;
}
.button::after {
content: "";
border-radius: 35px;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
clip-path: url(#mask);
border: 3px solid black;
}
.curve-1 {
animation: ʕ•̫͡•ʕ•̫͡•ʔ•̫͡•ʔ 20s infinite linear;
transform-origin: 35px center;
//animation-play-state: paused;
//transform: rotate(-315deg)
}
.curve-2 {
animation: ʕ•̫͡•ʕ•̫͡•ʔ•̫͡•ʔ•̫͡•ʔ•̫͡•ʔ 20s infinite linear;
transform-origin: 35px center;
translate: 136px 0;
}
.line {
animation: ʕ•̫͡•ʕ•̫͡•ʔ•̫͡•ʔ•̫͡•ʔ•̫͡•ʕ•̫͡•ʔ 20s infinite linear;
}
svg {
display: block;
}
#keyframes ʕ•̫͡•ʕ•̫͡•ʔ•̫͡•ʔ {
0% {
transform: rotate(45deg);
}
22% {
transform: rotate(-135deg);
}
27% {
transform: rotate(-180deg);
}
88% {
transform: rotate(-180deg);
}
89% {
transform: rotate(-225deg);
}
100% {
transform: rotate(-315deg);
}
}
#keyframes ʕ•̫͡•ʕ•̫͡•ʔ•̫͡•ʔ•̫͡•ʔ•̫͡•ʔ {
0% {
transform: rotate(0deg);
}
38% {
transform: rotate(0deg)
}
39% {
transform: rotate(-45deg);
}
50% {
transform: rotate(-135deg);
}
72% {
transform: rotate(-360deg);
}
100% {
transform: rotate(-360deg);
}
}
#keyframes ʕ•̫͡•ʕ•̫͡•ʔ•̫͡•ʔ•̫͡•ʔ•̫͡•ʕ•̫͡•ʔ {
0%, 100% {
width: 0;
x: 35px;
y: 35px;
}
11% {
width: 0;
x: 35px;
y: 35px;
}
22% {
width: 55px;
x: 35px;
y: 35px;
}
39% {
width: 55px;
x: 116px;
y: 35px;
}
50% {
width: 0;
x: 171px;
y: 35px;
}
61% {
width: 0;
x: 171px;
y: 0;
}
72% {
width: 55px;
x: 116px;
y: 0;
}
89% {
width: 55px;
x: 35px;
y: 0;
}
100% {
width: 0;
x: 35px;
y: 0;
}
}
<div class="button">button text</div>
<svg view-box="0 0 206 70" width="206" height="70">
<defs>
<clipPath id="mask">
<path d="M10.2513 10.1652C3.73208 16.8036 0.103643 25.7716 0.165885 35.0968C0.228128 44.422 3.97596 53.3408 10.5832 59.8905L35.1651 34.8632L10.2513 10.1652Z" fill="#000" class="curve-1"/>
<path d="M10.2513 10.1652C3.73208 16.8036 0.103643 25.7716 0.165885 35.0968C0.228128 44.422 3.97596 53.3408 10.5832 59.8905L35.1651 34.8632L10.2513 10.1652Z" fill="#000" class="curve-2"/>
<rect fill="#000" height="35" class="line">
</clipPath>
</defs>
</svg>
<svg view-box="0 0 206 70" width="206" height="70">
<path d="M10.2513 10.1652C3.73208 16.8036 0.103643 25.7716 0.165885 35.0968C0.228128 44.422 3.97596 53.3408 10.5832 59.8905L35.1651 34.8632L10.2513 10.1652Z" fill="#000" class="curve-1"/>
<path d="M10.2513 10.1652C3.73208 16.8036 0.103643 25.7716 0.165885 35.0968C0.228128 44.422 3.97596 53.3408 10.5832 59.8905L35.1651 34.8632L10.2513 10.1652Z" fill="#000" class="curve-2"/>
<rect fill="#000" height="35" class="line">
</svg>
Does anybody know anything about CSS rendering and why could this be happening?
I also created this CodePen where I just wanted to demonstrate that animating a clip-path is possible and it seems to work just fine here...
.masked {
width: 500px;
clip-path: url(#mask)
}
.mask {
width: 500px;
}
.circle {
animation: ʕ•̫͡•ʕ•̫͡•ʔ•̫͡•ʔ 2s infinite;
}
#keyframes ʕ•̫͡•ʕ•̫͡•ʔ•̫͡•ʔ {
0% {
translate: 0;
}
50% {
translate: 40px;
}
100% {
translate: 100px;
}
}
<img src="https://images.unsplash.com/photo-1542273917363-3b1817f69a2d?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Nnx8dHJlZXxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=900&q=60" class="masked"/>
<svg viewport="0 0 100 60">
<circle cx="50" cy="30" r="20" class="circle">
</svg>
<svg width="0" height="0">
<defs>
<clipPath id="mask">
<circle cx="100" cy="100" r="40" class="circle" />
</clipPath>
</defs>
</svg>
I have no idea why this's happening, if anyone knows the answer, I would be glad.
Thanks
Why so complicated? The same animation can be achieved with the stroke-dasharray technique.
For me, the animation appears smooth. Whether it is the same for you depends probably on hardware, but I am far down from your computing power.
.button {
width: 206px;
height: 70px;
line-height: 70px;
text-align: center;
position: relative;
border: 3px solid transparent;
}
.button .line {
position: absolute;
overflow: visible;
top: 0;
left: 0;
width: 100%;
height: 100%;
fill: none;
stroke: black;
stroke-width: 3px;
stroke-dasharray: 10px 90px;
animation: around 20s linear infinite;
}
#keyframes around {
0% {
stroke-dashoffset: 100px;
}
100% {
stroke-dashoffset: 0px;
}
}
<div class="button">button text<svg class="line" view-box="0 0 206 70">
<path d="M35,-1.5 A 36.5 36.5 0 0 0 35,71.5 H 171 A 36.5 36.5 0 0 0 171,-1.5 Z" pathLength="100" />
</svg>
Related
Invert the left svg animation?
Here is my code https://codepen.io/victoreugen2002/pen/PoJJPzP I am trying to animate the left and right svg, to acheive this: both starting at the same time from the top and they continue drawing. until they both met at the bottom in the middle. In order to acheive this I am thinking of inversing the animation for left svg, but it's not working: .left { width: 50%; stroke-dasharray: 1855.968505859375; animation: dash 2s ease-in; #keyframes dash { from { stroke-dashoffset: 1855.968505859375; } to { stroke-dashoffset: 3710; } } svg { left: 0; } }
You had to go from -1855.968505859375 to 0. .left { width: 50%; stroke-dasharray: 1855.968505859375; animation: dash-left 2s ease-in; } .left svg { left: 0; } .right { width: 50%; stroke-dasharray: 1855.968505859375; animation: dash-right 2s ease-in; } .right svg { right: 0; } svg { position: absolute; top: 20px; width: 50%; stroke-width: 5px; } #keyframes dash-left { from { stroke-dashoffset: -1855.968505859375 } to { stroke-dashoffset: 0 } } #keyframes dash-right { from { stroke-dashoffset: 1855.968505859375 } to { stroke-dashoffset: 0 } } <div class="left"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 733 425"> <path d="M733,424.5H39A38.5,38.5,0,0,1,.5,386V39A38.5,38.5,0,0,1,39,.5H733" style="fill: none;stroke: #78be21"/> </svg> </div> <div class="right"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 733 425"> <path d="M0,.5H694A38.5,38.5,0,0,1,732.5,39V386A38.5,38.5,0,0,1,694,424.5H0" style="fill: none;stroke: #78be21"/> </svg> </div>
Editting the CSS animation
I found a css animation online, but i wanted to edit it a bit. This is the link to the animation Is there anyway i can make this animation run only when a certain button on the website is clicked, and is it possible that the door opens only once and it leads to a different site on the other end of the door?? Right now the door animation is running infinite times. Please help body { display: flex; width: 100%; height: 100vh; background: #222; perspective: 100vw; overflow: hidden; animation: squiggly-anim 0.4s infinite; -webkit-animation: squiggly-anim 0.2s infinite; } #-webkit-keyframes squiggly-anim { 0% { filter: url("#squiggly-0"); } 25% { filter: url("#squiggly-1"); } 50% { filter: url("#squiggly-2"); } 75% { filter: url("#squiggly-3"); } 100% { filter: url("#squiggly-4"); } } #keyframes squiggly-anim { 0% { filter: url("#squiggly-0"); } 25% { filter: url("#squiggly-1"); } 50% { filter: url("#squiggly-2"); } 75% { filter: url("#squiggly-3"); } 100% { filter: url("#squiggly-4"); } } body .door { position: absolute; width: 100px; height: 200px; left: calc(50% - 50px); top: calc(50% - 100px); box-shadow: inset 0 -5px 0 0 #222, inset 0 0 0 1px #fff, 0 5px 0 0 #222, 0 0 0 100vw #222; perspective: 500px; transform-style: preserve-3d; -webkit-animation: scaling 5s linear infinite; animation: scaling 5s linear infinite; transform: translateZ(-1px); } body .door:nth-of-type(3) { -webkit-animation-delay: 1.25s; animation-delay: 1.25s; } body .door:nth-of-type(3) .face { -webkit-animation-delay: 1.25s; animation-delay: 1.25s; } body .door:nth-of-type(2) { -webkit-animation-delay: 2.5s; animation-delay: 2.5s; } body .door:nth-of-type(2) .face { -webkit-animation-delay: 2.5s; animation-delay: 2.5s; } body .door:nth-of-type(1) { -webkit-animation-delay: 3.75s; animation-delay: 3.75s; } body .door:nth-of-type(1) .face { -webkit-animation-delay: 3.75s; animation-delay: 3.75s; } #-webkit-keyframes scaling { 0% { transform: translateZ(0vw); opacity: 1; z-index: 0; } 50% { transform: translateZ(100vw); opacity: 1; z-index: 1; } 95% { transform: translateZ(200vw); opacity: 1; z-index: 2; } 100% { transform: translateZ(300vw); opacity: 0; z-index: 3; } } #keyframes scaling { 0% { transform: translateZ(0vw); opacity: 1; z-index: 0; } 50% { transform: translateZ(100vw); opacity: 1; z-index: 1; } 95% { transform: translateZ(200vw); opacity: 1; z-index: 2; } 100% { transform: translateZ(300vw); opacity: 0; z-index: 3; } } #keyframes scaling { 0% { transform: translateZ(0vw); opacity: 1; z-index: 0; } 50% { transform: translateZ(100vw); opacity: 1; z-index: 1; } 95% { transform: translateZ(200vw); opacity: 1; z-index: 2; } 100% { transform: translateZ(300vw); opacity: 0; z-index: 3; } } #keyframes scaling { 0% { transform: translateZ(0vw); opacity: 1; z-index: 0; } 50% { transform: translateZ(100vw); opacity: 1; z-index: 1; } 95% { transform: translateZ(200vw); opacity: 1; z-index: 2; } 100% { transform: translateZ(300vw); opacity: 0; z-index: 3; } } #keyframes scaling { 0% { transform: translateZ(0vw); opacity: 1; z-index: 0; } 50% { transform: translateZ(100vw); opacity: 1; z-index: 1; } 95% { transform: translateZ(200vw); opacity: 1; z-index: 2; } 100% { transform: translateZ(300vw); opacity: 0; z-index: 3; } } #keyframes scaling { 0% { transform: translateZ(0vw); opacity: 1; z-index: 0; } 50% { transform: translateZ(100vw); opacity: 1; z-index: 1; } 95% { transform: translateZ(200vw); opacity: 1; z-index: 2; } 100% { transform: translateZ(300vw); opacity: 0; z-index: 3; } } #keyframes scaling { 0% { transform: translateZ(0vw); opacity: 1; z-index: 0; } 50% { transform: translateZ(100vw); opacity: 1; z-index: 1; } 95% { transform: translateZ(200vw); opacity: 1; z-index: 2; } 100% { transform: translateZ(300vw); opacity: 0; z-index: 3; } } body .door:after { content: ""; position: absolute; width: 200vw; height: 100vw; left: -50vw; bottom: 5px; box-shadow: 0 1px 0 0 #fff; z-index: -1; } body .door .face { position: absolute; left: 0; top: 0; width: 100%; height: calc(100% - 4px); transform-style: preserve-3d; box-shadow: inset 0 0 0 1px #fff; background: #222; transform-origin: left; -webkit-animation: swing 5s ease-in-out infinite; animation: swing 5s ease-in-out infinite; } body .door .face:before { content: ""; position: absolute; width: 10px; height: 10px; box-shadow: 0 0 0 1px #fff; border-radius: 100%; right: 10px; top: calc(50% - 5px); transform-style: preserve-3d; transform: translateZ(6px); -webkit-backface-visibility: hidden; backface-visibility: hidden; background: #222; } body .door .face:after { content: ""; position: absolute; width: 4px; height: 2.5px; box-shadow: 0 0 0 1px #fff; opacity: 0.75; border-radius: 0; right: 10px; top: calc(50% - 1.25px); transform-style: preserve-3d; transform: translateZ(2.5px) rotateY(90deg); -webkit-backface-visibility: hidden; backface-visibility: hidden; background: #222; } #-webkit-keyframes swing { 15% { transform: rotateY(0deg); } 50% { transform: rotateY(-125deg) translateZ(-2px); } 75% { transform: rotateY(-125deg); } 100% { transform: rotateY(-125deg); } } #keyframes swing { 15% { transform: rotateY(0deg); } 50% { transform: rotateY(-125deg) translateZ(-2px); } 75% { transform: rotateY(-125deg); } 100% { transform: rotateY(-125deg); } } body .door .face .right { position: absolute; width: 10%; background: #222; height: 100%; top: 0; right: -10%; transform-origin: left; transform: rotateY(90deg); box-shadow: inset 0 0 0 1px #fff; } <div class='door'> <div class='face'> <div class='right'></div> </div> </div> <div class='door'> <div class='face'> <div class='right'></div> </div> </div> <div class='door'> <div class='face'> <div class='right'></div> </div> </div> <div class='door'> <div class='face'> <div class='right'></div> </div> </div> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" style="display:none"> <defs> <filter id="squiggly-0"> <feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="0"/> <feDisplacementMap id="displacement" in="SourceGraphic" in2="noise" scale="2" /> </filter> <filter id="squiggly-1"> <feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="1"/> <feDisplacementMap in="SourceGraphic" in2="noise" scale="3" /> </filter> <filter id="squiggly-2"> <feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="2"/> <feDisplacementMap in="SourceGraphic" in2="noise" scale="2" /> </filter> <filter id="squiggly-3"> <feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="3"/> <feDisplacementMap in="SourceGraphic" in2="noise" scale="3" /> </filter> <filter id="squiggly-4"> <feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="4"/> <feDisplacementMap in="SourceGraphic" in2="noise" scale="1" /> </filter> </defs> </svg>
There are a three main parts to this question. First, how to have just one door in the animation. There are 4 divs with class door. If we take 3 of these out the remaining one animates, but there is a delay before the animation (needed in the original so that the 4 doors started their movements at staggered times) so we take that out. While we are at it we notice that there are several #keyframes repeated - only the last one would be used so we remove those too. Second, the requirement is to start the door animation on clicking a button. So we add a button element and in JS attach an event listener to it. When clicked it will add the class 'open' to the door. In the CSS the animation to the door and the door face are changed so they are added when the class is open.u Third the requirement is to go to a website when the door has opened. Ideally one would want the website gradually revealed as the door is opened. This can be achieved if the website is under our control, for example the code could be run at the start of the website and it would gradually get revealed. If not a similar effect can be achieved by putting the target website in an iframe and gradually revealing it. However, many websites do not allow this and in this snippet just for fun we have put an image behind the door and gone to the website only once it is fully open. This is just to demonstrate possibilities. There may be a better way of doing it - let's hope so. let page = "https://stackoverflow.com"; let button = document.getElementById('opendoor'); let door = document.querySelector('.door'); let face = document.querySelector('.face'); //document.querySelector("#target").src = page;//only do this if the target website lets you have an iframe button.addEventListener('click', function () { door.classList.add('open'); button.style.display = 'none'; document.body.style.animation = 'none'; }); face.addEventListener('webkitAnimationEnd', gotopage);//webkit still needed for some browsers face.addEventListener('animationEnd', gotopage); function gotopage() { document.getElementById('doorwrapper').style.display = 'none'; window.location= page; } * { margin: 0; padding: 0; box-sizing: border-box; } body { background-color: #222; width: 100%; height: 100vh; overflow: hidden; perspective: 100vw; overflow: hidden; animation: squiggly-anim 0.4s infinite; } #doorwrapper { position: absolute; top: -10px; left: -10px;/* attempt to stop shakiness at margin black against white */ display: flex; width: calc(100vw + 20px); height: calc(100vh + 20px); background-color: transparent; z-index: 99999; } #keyframes squiggly-anim { 0% { filter: url("#squiggly-0"); } 25% { filter: url("#squiggly-1"); } 50% { filter: url("#squiggly-2"); } 75% { filter: url("#squiggly-3"); } 100% { filter: url("#squiggly-4"); } } #doorwrapper .door { position: absolute; width: 100px; height: 200px; left: calc(50% - 50px); top: calc(50% - 100px); box-shadow: inset 0 -5px 0 0 #222, inset 0 0 0 1px #fff, 0 5px 0 0 #222, 0 0 0 100vw #222; perspective: 500px; transform-style: preserve-3d; animation-fill-mode: forwards; transform: translateZ(-1px); } #doorwrapper .door.open { animation: scaling 5s linear 1; } #keyframes scaling { 0% { transform: translateZ(0vw); opacity: 1; } 50% { transform: translateZ(100vw); opacity: 1; } 95% { transform: translateZ(200vw); opacity: 1; } 100% { transform: translateZ(300vw); opacity: 0; } } #doorwrapper .door:after { content: ""; position: absolute; width: 200vw; height: 100vw; left: -50vw; bottom: 5px; box-shadow: 0 1px 0 0 #fff; z-index: -1; } #doorwrapper .door .face { position: absolute; left: 0; top: 0; width: 100%; height: calc(100% - 4px); transform-style: preserve-3d; box-shadow: inset 0 0 0 1px #fff; background: #222; transform-origin: left; animation-fill-mode: forwards; } #doorwrapper .door.open .face { animation: swing 5s ease-in-out 1; } #doorwrapper .door .face:before { content: ""; position: absolute; width: 10px; height: 10px; box-shadow: 0 0 0 1px #fff; border-radius: 100%; right: 10px; top: calc(50% - 5px); transform-style: preserve-3d; transform: translateZ(6px); backface-visibility: hidden; background: #222; } #doorwrapper .door .face:after { content: ""; position: absolute; width: 4px; height: 2.5px; box-shadow: 0 0 0 1px #fff; opacity: 0.75; border-radius: 0; right: 10px; top: calc(50% - 1.25px); transform-style: preserve-3d; transform: translateZ(2.5px) rotateY(90deg); backface-visibility: hidden; background: #222; } #keyframes swing { 15% { transform: rotateY(0deg); } 50% { transform: rotateY(-125deg) translateZ(-2px); } 75% { transform: rotateY(-125deg); } 100% { transform: rotateY(-125deg); } } #doorwrapper .door .face .right { position: absolute; width: 10%; background: #222; height: 100%; top: 0; right: -10%; transform-origin: left; transform: rotateY(90deg); box-shadow: inset 0 0 0 1px #fff; } <div id="doorwrapper"> <div class='door'> <div class='face'> <div class='right'></div> </div> </div> </div> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" style="display:none"> <defs> <filter id="squiggly-0"> <feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="0"/> <feDisplacementMap id="displacement" in="SourceGraphic" in2="noise" scale="2" /> </filter> <filter id="squiggly-1"> <feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="1"/> <feDisplacementMap in="SourceGraphic" in2="noise" scale="3" /> </filter> <filter id="squiggly-2"> <feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="2"/> <feDisplacementMap in="SourceGraphic" in2="noise" scale="2" /> </filter> <filter id="squiggly-3"> <feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="3"/> <feDisplacementMap in="SourceGraphic" in2="noise" scale="3" /> </filter> <filter id="squiggly-4"> <feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="4"/> <feDisplacementMap in="SourceGraphic" in2="noise" scale="1" /> </filter> </defs> </svg> <button id="opendoor" style="position: absolute; top: 10px; left: 10px; color: white; background-color: red; z-index: 99999;">Open the door</button> <!-- YOUR WEBSITE - OR IFRAME WITH THE TARGET WEBSITE IN IT (OR WILL GO TO WEBSITE ON END OF ANIMATION IF IFRAME NOT ALLOWED --> <!-- <iframe id="target" width=100% height=100% src=""></iframe> --> <img id="mywebsite" src="https://i.stack.imgur.com/qsQbR.jpg" style="position: relative; top: 0; left: 0; z-index: 0; width: 100vw; height: auto;"/>
Have element appear in same location as another during CSS animation
I would like to have a balloon pop and when it does I comic style "POP" SVG will appear indicating the pop. I am struggling to figure out a way to position the pop svg so it is at the same location as the balloon popping. You can see it happen in my code at around 18-19 seconds. The turtle on the balloon comes in for the second time and then starts to fade out. You can see the POP happen on the top-left of the screen. Any ideas on how I can get them to line up? Should I use JS? html { box-sizing:border-box; } *, *:before, *:after { /* allow all elements to inherit box-sizing */ box-sizing: inherit; } html, body { margin:0; padding:0; overflow:hidden; width: 100vw; height: 100vh; } .BalloonContainer { position: absolute; overflow: hidden; top: 0; right: 0; left: 0; bottom: 0; } .flying img { max-width: 150px; position: absolute; top: 20px; transform: translateX(-30vw); animation: moveBird 2s linear 16.9s 1 forwards; } #-webkit-keyframes moveBird { 0% { transform: translateX(-30vw) rotate(3deg); } 50% { transform: rotate(-3deg); } 100% { transform: translateX(45vw) rotate(3deg); } } .initialBalloon { position: absolute; /* moves initial position before animating */ transform: translateX(100vw); top: 150px; animation: moveFirst 2s linear .2s 1; width: 150px; } .firstBalloon { position: absolute; transform: translateX(-30vw); top: 150px; animation: move 5s linear 5s infinite; width: 150px; } .secondBalloon { position: absolute; transform: translateX(-30vw); top: 200px; animation: move 8s linear 0s infinite; width: 150px; } .thirdBalloon { top: 250px; transform: translateX(-30vw); position: absolute; animation: move 11s linear 1s infinite; width: 150px; } .turtle { position: absolute; top: 50px; transform: translateX(-50vw); opacity: 1; animation: moveTurtle 5s linear 1s 1 none, moveTurtleStop 11s linear 6s 1 forwards, moveTurtleRotate 5s linear 17s infinite forwards, hideOpacity 1s linear 19s 1 forwards; width: 250px; } .pop { position: absolute; opacity: 0; top: 50px; width: 100px; transform: translateX(0vw) translateY(0vw); animation: pow 1s linear 19s 1 none; } #-webkit-keyframes pow { 0% { transform: scale(0); opacity: 0; } 50% { transform: scale(1); opacity: 1; } 100% { transform: scale(0); opacity: 0; } } #-webkit-keyframes hideOpacity { 0% { opacity: 1; } 100% { opacity: 0; } } #-webkit-keyframes moveTurtle { 0% { transform: translateX(-50vw) rotate(10deg); } 50% { transform: rotate(-5deg); } 100% { transform: translateX(100vw) rotate(10deg); } } #-webkit-keyframes moveTurtleRotate { 0% { transform: translateX(50vw) rotate(10deg); } 50% { transform: translateX(50vw) rotate(-5deg); } 100% { transform: translateX(50vw) rotate(10deg); } } #-webkit-keyframes moveTurtleStop { 0% { transform: translateX(-50vw) rotate(10deg); } 50% { transform: rotate(-5deg); } 100% { transform: translateX(50vw) rotate(10deg); } } #-webkit-keyframes move { 0% { transform: translateX(-30vw) rotate(10deg); } 50% { transform: rotate(-5deg); } 100% { transform: translateX(100vw) rotate(10deg); } } #-webkit-keyframes moveFirst { 0% { transform: translateX(50vw) rotate(10deg); } 50% { transform: translateX(75vw) rotate(-5deg); } 100% { transform: translateX(100vw) rotate(10deg); } } #-webkit-keyframes fade-in { 0% { opacity: 0; visibility: hidden; } 100% { opacity: 1; visibility: visible; } } #keyframes fade-in { 0% { opacity: 0; visibility: hidden; } 100% { opacity: 1; visibility: visible; } } #-webkit-keyframes fade-out { 0% { opacity: 1; visibility: visible; } 100% { opacity: 0; visibility: hidden; } } #keyframes fade-out { 0% { opacity: 1; visibility: visible; } 100% { opacity: 0; visibility: hidden; } } <div class="BalloonContainer"> <div class="flying"> <img src="https://williamcunningham.me/happy_birthday_2019/img/flyNew.gif" alt=""> </div> <div class="initialBalloon swingimage"> <svg id="Balloon_1" data-name="Balloon_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48.82 125.26"><defs><style>.cls-1{fill:#606060;}</style></defs><title>Balloon_1</title><path class="cls-1" d="M15.34,1.26s-18,9-15,26,19,28,19,28a22.69,22.69,0,0,0,4,1c1,0-2,2-1,3h5s2,0-1-3c0,0,18-6,22-28S30.34-3.74,15.34,1.26Zm-4,25h-6c-2-14,13-20,13-20C8.34,14.26,11.34,26.26,11.34,26.26Z" transform="translate(0 0)"/><polygon id="string_1" class="cls-1" points="22.34 125.26 24.41 57.26 25.57 57.26 26.34 125.26 22.34 125.26"/></svg> </div> <div class="firstBalloon swingimage"> <svg id="Balloon_2" data-name="Balloon_2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48.82 125.26"><defs><style>.cls-1{fill:#606060;}</style></defs><title>Balloon_2</title><path class="cls-1" d="M15.34,1.26s-18,9-15,26,19,28,19,28a22.69,22.69,0,0,0,4,1c1,0-2,2-1,3h5s2,0-1-3c0,0,18-6,22-28S30.34-3.74,15.34,1.26Zm-4,25h-6c-2-14,13-20,13-20C8.34,14.26,11.34,26.26,11.34,26.26Z" transform="translate(0 0)"/><polygon id="string_2" class="cls-1" points="22.34 125.26 24.41 57.26 25.57 57.26 26.34 125.26 22.34 125.26"/></svg> </div> <div class="secondBalloon swingimage"> <svg id="Balloon_3" data-name="Balloon_3" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48.82 125.26"><defs><style>.cls-1{fill:#606060;}</style></defs><title>Balloon_3</title><path class="cls-1" d="M15.34,1.26s-18,9-15,26,19,28,19,28a22.69,22.69,0,0,0,4,1c1,0-2,2-1,3h5s2,0-1-3c0,0,18-6,22-28S30.34-3.74,15.34,1.26Zm-4,25h-6c-2-14,13-20,13-20C8.34,14.26,11.34,26.26,11.34,26.26Z" transform="translate(0 0)"/><polygon id="string_3" class="cls-1" points="22.34 125.26 24.41 57.26 25.57 57.26 26.34 125.26 22.34 125.26"/></svg> </div> <div class="thirdBalloon swingimage"> <svg id="Balloon_4" data-name="Balloon_4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48.82 125.26"><defs><style>.cls-1{fill:#606060;}</style></defs><title>Balloon_4</title><path class="cls-1" d="M15.34,1.26s-18,9-15,26,19,28,19,28a22.69,22.69,0,0,0,4,1c1,0-2,2-1,3h5s2,0-1-3c0,0,18-6,22-28S30.34-3.74,15.34,1.26Zm-4,25h-6c-2-14,13-20,13-20C8.34,14.26,11.34,26.26,11.34,26.26Z" transform="translate(0 0)"/><polygon id="string_4" class="cls-1" points="22.34 125.26 24.41 57.26 25.57 57.26 26.34 125.26 22.34 125.26"/></svg> </div> <div class="theTurtle"> <div class="turtle swingimage"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104.826 171.637"><defs><style>.cls-1{fill:#171618;}</style></defs><title>turtleandBalloon</title><g id="balloonTotalMain"><polygon id="stringMain" class="cls-1" points="38.5 121.946 40.57 53.946 41.734 53.946 42.5 121.946 38.5 121.946"/><path id="bPiece_8" class="cls-1" d="M37.608,52.314a3.2,3.2,0,0,1-2.537-1.509c-.841-1.122-1.6-2.316-2.265-3.37a24.353,24.353,0,0,0-1.788-2.6,6.229,6.229,0,0,1-1.745,2.484l-.7.654-.648-.71a45.517,45.517,0,0,1-8.488-12.955l-.348-.83.809-.394a23.644,23.644,0,0,1,9.887-2.607,12.738,12.738,0,0,1,4.482.772c4,1.5,5.27,2.77,6.29,3.79.873.873,1.45,1.45,4.006,1.876.5.083.929.151,1.3.21,1.876.3,2.508.4,2.745,1.171.221.72-.294,1.2-.839,1.713a13.461,13.461,0,0,0-2.547,3.1c-.435.725-.871,1.5-1.306,2.266C41.9,48.942,39.989,52.314,37.608,52.314Z" transform="translate(0)"/><path id="bPiece_7" class="cls-1" d="M38.771,58.327l-.279-.279c-.919-.919-.351-2.028.211-2.8-.253-.061-.549-.137-.9-.233l.09-1.855a5.7,5.7,0,0,0,3.762-2.436c-.478-.6-.793-2.114,4.926-7.832l1.16-1.16,2.668,9.782-.553.384A32.485,32.485,0,0,1,44.6,54.89c.84,1.045,1.077,1.831.791,2.523a1.563,1.563,0,0,1-1.464.914Z" transform="translate(0)"/><path id="bPiece_6" class="cls-1" d="M51.541,49.085c-.379-.864-.777-1.619-1.128-2.286-.8-1.521-1.379-2.619-1.035-3.688a2.327,2.327,0,0,1,1.264-1.347c.459-.229.4-.843-.021-2.573a13.811,13.811,0,0,1-.506-3.24A2.445,2.445,0,0,1,52.726,33.2c1.515,0,3.662.811,6.313,1.871a11.3,11.3,0,0,0,2.344.675l1.216.2-.5,1.127a35.34,35.34,0,0,1-9.059,12.35l-.976.855Z" transform="translate(0)"/><path id="bPiece_5" class="cls-1" d="M60.97,34.233c-2.069,0-6.1-2.761-7.838-5.371-.727-1.091-1.157-1.8-.853-2.507a1.522,1.522,0,0,1,1.3-.8,2.591,2.591,0,0,0,1.58-.749c.641-.641.641-.641-.076-1.757a21.183,21.183,0,0,1-2.039-3.882,3.453,3.453,0,0,1,.01-3.3,3.4,3.4,0,0,1,3.023-1.233,11.437,11.437,0,0,1,2.373.288l3.905-3.255.546,1.049a23.4,23.4,0,0,1,1.962,15.318,41.07,41.07,0,0,1-1.216,4.934l-.186.593-.617.068a1.511,1.511,0,0,0-.634.153,1.684,1.684,0,0,1-1.236.458Z" transform="translate(0)"/><path id="bPiece_4" class="cls-1" d="M46.6,35.438c-1.948,0-4.19-1.226-5.673-2.037-.295-.161-.553-.3-.763-.407-1.261-.631-1.955-2.074-1.955-4.065a13.4,13.4,0,0,1,1.529-5.782c.814-1.629-.922-3.439-3.464-5.816-1.451-1.357-2.822-2.639-3.253-3.931a2.483,2.483,0,0,1,.348-2.318c1.137-1.577,4-2.149,5.644-2.149a3.255,3.255,0,0,1,2.188.577,1.147,1.147,0,0,0,.256.023,9.438,9.438,0,0,0,6.85-4.478,4.728,4.728,0,0,1,3.6-2.272l.315-.061.288.141a24.215,24.215,0,0,1,6.837,4.955l.9.944-1.176.571c-1.184.575-1.776,2.35-2.348,4.066-1.1,3.3-1.5,3.456-6.43,4.442-1.9.379-1.529,3.177-.75,7.4.463,2.51.941,5.106.545,7.087A3.418,3.418,0,0,1,46.6,35.438Z" transform="translate(0)"/><path id="bPiece_3" class="cls-1" d="M34.744,6.628a41.641,41.641,0,0,1-6.839-.642l-2.144-.361,1.72-1.33a31.067,31.067,0,0,1,4.592-3l.061-.031.065-.021A25.071,25.071,0,0,1,40.14,0a28.537,28.537,0,0,1,9.942,1.811L53.227,3l-3.3.642c-1.9.37-3.83.872-5.7,1.358a61.208,61.208,0,0,1-6.356,1.429A22.338,22.338,0,0,1,34.744,6.628Z" transform="translate(0)"/><path id="bPiece_2" class="cls-1" d="M38.856,35.344c-.626,0-1.353-.411-2.681-1.518s-3.576-1.674-6.669-1.674A44.457,44.457,0,0,0,19.948,33.4l-.815.184-.288-.784a33.419,33.419,0,0,1-1.565-5.73C15.311,15.914,22.554,8.23,27.046,4.643l.438-.349L28,4.507A4.327,4.327,0,0,1,29.954,5.9l.226.33L30.1,6.62c-.044.219-1.12,5.364-5.463,6.45-.446.111-.889.623-1.283,1.478-1.8,3.91-1.525,12.217-.953,13.36a1.188,1.188,0,0,0,.594.1c2.022,0,5.736-1.887,6.272-2.958.376-.751.376-3.224.376-5.406,0-2.592,0-5.273.524-6.848.128-.384.518-1.552,1.537-1.552,1.628,0,2.087,3.241,2.194,4.346.242.154.708.39,1.1.587,1.764.893,4.431,2.242,5.082,4.5a4.177,4.177,0,0,1-.573,3.388c-1.186,1.976-.366,5.247.176,7.411.441,1.757.683,2.725.156,3.4A1.219,1.219,0,0,1,38.856,35.344Z" transform="translate(0)"/><path id="bPiece_1" class="cls-1" d="M37.808,55.018c-.941-.262-1.8-.548-1.8-.548l-.128-.043-.111-.076a50.878,50.878,0,0,1-7.848-7.087l-.636-.7.691-.643a4.436,4.436,0,0,0,1.24-1.706c.42-1.258,1.124-1.522,1.642-1.522,1.2,0,2.089,1.4,3.558,3.719.648,1.024,1.382,2.185,2.178,3.246.256.341.64.748,1.014.748,1.27,0,3.222-3.454,4.647-5.976.444-.784.887-1.569,1.331-2.308a14.855,14.855,0,0,1,2.4-3.051c-.137-.023-1.237-.2-1.74-.281-3.158-.526-4.03-1.4-5.04-2.408-.889-.889-2-2-5.612-3.352a10.807,10.807,0,0,0-3.813-.651A21.766,21.766,0,0,0,20.728,34.8l-.905.442-.39-.929c-.207-.494-.4-1-.588-1.508l-.376-1.019,1.059-.239a46.388,46.388,0,0,1,9.978-1.295c3.551,0,6.2.711,7.888,2.115.267.222.49.4.676.539-.072-.314-.158-.655-.235-.965-.619-2.469-1.555-6.2.038-8.855a2.327,2.327,0,0,0,.376-1.879c-.421-1.458-2.642-2.582-4.112-3.325-1.318-.667-2.113-1.069-2.113-1.923a8.684,8.684,0,0,0-.262-1.607,40.322,40.322,0,0,0-.214,5.3c0,2.739,0,5.1-.577,6.258C30,27.839,25.462,29.914,23,29.914a2.31,2.31,0,0,1-2.3-1.155c-.927-1.855-1-10.818.927-15.006a4.087,4.087,0,0,1,2.55-2.53c2.516-.63,3.591-3.374,3.931-4.5a3.714,3.714,0,0,0-.827-.458l-1.5-.615,1.7-1.357.331-.257.412.07a39.9,39.9,0,0,0,6.522.614A20.471,20.471,0,0,0,37.6,4.539,60.105,60.105,0,0,0,43.75,3.152c1.9-.494,3.861-1,5.814-1.384l.265-.051.252.094c.829.311,1.648.666,2.434,1.052l2.538,1.248-2.776.541a3.006,3.006,0,0,0-2.262,1.255,11.139,11.139,0,0,1-8.554,5.53,2.1,2.1,0,0,1-1.541-.522l0,0a4.733,4.733,0,0,0-.9-.08c-1.507,0-3.513.546-4.1,1.359a.6.6,0,0,0-.086.6c.278.835,1.533,2.008,2.746,3.143,2.4,2.242,5.381,5.032,3.867,8.058-1.769,3.539-1.644,6.683-.426,7.292.228.114.507.267.825.441,1.234.674,3.3,1.8,4.76,1.8.68,0,1.348-.191,1.626-1.579.324-1.622-.121-4.035-.551-6.368-.764-4.142-1.629-8.838,2.249-9.613,4.22-.844,4.22-.844,5-3.177.7-2.091,1.417-4.252,3.323-5.177l.624-.3.48.5A21.346,21.346,0,0,1,62.9,12.709l.354.681-4.342,3.618-.485-.137a9.989,9.989,0,0,0-2.351-.34c-.737,0-1.278.148-1.446.4s-.106.812.181,1.53a19.3,19.3,0,0,0,1.872,3.558c.865,1.345,1.548,2.407-.178,4.134a4.325,4.325,0,0,1-2.1,1.178c.082.13.184.288.31.477,1.525,2.287,5.061,4.521,6.252,4.524a3.07,3.07,0,0,1,1.661-.6l1.451-.162-.437,1.393A38.8,38.8,0,0,1,62.1,37.067l-.3.673-.726-.119a13.148,13.148,0,0,1-2.744-.786C56.046,35.921,53.9,35.1,52.726,35.1c-.47,0-.706,0-.706.851a12.127,12.127,0,0,0,.452,2.792c.428,1.772.913,3.779-.979,4.725-.215.108-.291.193-.3.227a6.142,6.142,0,0,0,.907,2.217c.366.7.78,1.482,1.187,2.407l.281.638-.525.461a36.019,36.019,0,0,1-3.18,2.483l-1.107.767-1.973-7.233a20.392,20.392,0,0,0-3.406,4.381,1.666,1.666,0,0,1,.125,1.4c-.465,1.477-2.694,3.363-5.271,3.818l-.213.038ZM27.559,25a21.326,21.326,0,0,1,2.882-14.059c-3.465,2.727-7.247,7.3-6.617,14.059Z" transform="translate(0)"/></g><g id="turtleMain"><path id="turtleBody" class="cls-1" d="M103.914,147.832a37.959,37.959,0,0,0-6.666-6.665s-1.9-2.857-6.665-1.905-9.522,2.857-7.617.953,1.9-2.857-.953-2.857c-.952,0-17.139-15.235-27.613-17.139s-11.426-2.857-19.043-2.857c0,0-17.14-.952-31.422,19.044,0,0-4.761.952-3.809,3.809s7.617,7.617,5.713,10.474-6.665,8.569-3.809,11.426S16.313,156.4,16.313,156.4s17.139,11.426,39.039.952c0,0,1.905,0,1.905,3.809s-.952,10.474,1.9,10.474,9.522-11.427,9.522-11.427,3.809-3.808.952-6.665c0,0-1.9-1.9-.952-2.856s6.665-5.713,10.474-.953,3.809,6.666,9.522,6.666,13.33-2.857,13.33-2.857S106.77,151.641,103.914,147.832Zm-99.027-8.57s24.756,34.279,72.366,0C77.253,139.262,32.5,180.206,4.887,139.262Zm88.077,11.427a4.285,4.285,0,1,1,4.284-4.285A4.285,4.285,0,0,1,92.964,150.689Z" transform="translate(0)"/><circle id="eyeballMain" class="cls-1" cx="94.392" cy="145.928" r="0.952"/></g></svg> </div> <!-- POW --> <div class="pop"> <svg id="pop" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 392.251 373.053"><defs><style>.cls-1{fill:#ed2f2f;}</style></defs><title>pop</title><g id="letterHole"><path class="cls-1" d="M220.443,178.854c0-.954,0-1.871.024-2.806a12.231,12.231,0,0,1,3.405-.7c.088,0,.165,0,.232.007a9.469,9.469,0,0,1-2.129,2.623,15.561,15.561,0,0,1-1.532,1.409Z"/><path d="M223.872,173.387a17.568,17.568,0,0,0-5.312,1.232c-.078,1.463-.078,2.849-.078,4.235v4.157a19,19,0,0,0,4.851-3.618c1.925-1.848,2.849-3.311,2.849-4.389s-.77-1.617-2.31-1.617Z"/></g><g id="letterHole2"><path class="cls-1" d="M185.6,202.994a5.2,5.2,0,0,1-4.975-2.978,13.791,13.791,0,0,1-1.3-7.053,29.148,29.148,0,0,1,2.318-9.742c1.072-2.529,2.863-5.563,5.27-5.563,1.763,0,3.206,1.741,4.29,5.174a27.584,27.584,0,0,1,1.22,9.251,16.944,16.944,0,0,1-1.916,7.463C188.859,202.6,187.021,202.994,185.6,202.994Z"/><path d="M186.912,179.619c.729,0,1.7,1.529,2.406,3.757a25.656,25.656,0,0,1,1.145,8.608,15.057,15.057,0,0,1-1.691,6.646c-1.194,2.217-2.262,2.4-3.168,2.4a3.247,3.247,0,0,1-3.233-1.92,11.947,11.947,0,0,1-1.087-6.067A27.1,27.1,0,0,1,183.441,184c1.145-2.7,2.476-4.384,3.471-4.384m0-3.922c-2.771,0-5.158,2.233-7.083,6.775a30.95,30.95,0,0,0-2.464,10.395,15.692,15.692,0,0,0,1.54,8.084,7.122,7.122,0,0,0,6.7,4c2.848,0,5-1.463,6.622-4.466a18.974,18.974,0,0,0,2.155-8.315,29.434,29.434,0,0,0-1.309-9.933c-1.385-4.388-3.465-6.544-6.16-6.544Z"/></g><g id="letterHole3"><path class="cls-1" d="M147.681,178.854c0-.954,0-1.871.023-2.806a12.237,12.237,0,0,1,3.405-.7c.088,0,.165,0,.233.007a9.5,9.5,0,0,1-2.13,2.623,15.419,15.419,0,0,1-1.531,1.408Z"/><path d="M151.109,173.387a17.586,17.586,0,0,0-5.313,1.232c-.076,1.463-.076,2.849-.076,4.235v4.157a19.012,19.012,0,0,0,4.85-3.618c1.925-1.848,2.849-3.311,2.849-4.389s-.771-1.617-2.31-1.617Z"/></g><g id="full"><path class="cls-1" d="M196.125,281.119l-58.461,85.333,2.861-103.4L43.071,297.727l63.092-81.97L6.94,186.526l99.223-29.23L43.071,75.326,140.525,110,137.664,6.6l58.461,85.333L254.587,6.6,251.726,110l97.453-34.674-63.09,81.97,99.222,29.23-99.223,29.231,63.091,81.97-97.453-34.674,2.861,103.4Zm52.493-78.044a13.514,13.514,0,0,0-1.477.085,12.807,12.807,0,0,0-6.6,3,8.95,8.95,0,0,0-3.224,6.8,6.883,6.883,0,0,0,3.615,6.327,9.169,9.169,0,0,0,4.949,1.369,12.26,12.26,0,0,0,1.769-.134,13.325,13.325,0,0,0,6.49-2.881,8.808,8.808,0,0,0,3.344-6.837,7.092,7.092,0,0,0-3.636-6.295A9.641,9.641,0,0,0,248.618,203.075Zm-84.57-24.557a47.259,47.259,0,0,0-1.193,8.718,43.558,43.558,0,0,0,3.716,20.148c3.635,8.116,9.081,12.236,16.184,12.236,6.906,0,12.664-4.043,17.112-12.016a46.244,46.244,0,0,0,5.712-20.171,43.941,43.941,0,0,0-3.711-20.161c-3.639-8.126-9.087-12.247-16.187-12.247-6.957,0-12.741,4.043-17.19,12.017a44.035,44.035,0,0,0-2.729,5.858,19.435,19.435,0,0,0,.243-3.055,21.653,21.653,0,0,0-.418-3.981c-.781-3.97-3.763-8.683-13.554-8.683-5.192,0-11.538,1.225-18.862,3.641l-1.437.474.093,1.51c.441,7.1.979,16.388,1.229,25.189l.54,17.867c.147,5.4.3,8.845.387,10.156l.162,2.449L149.212,214l-.154-1.608c-.511-5.328-.873-10.534-1.1-15.882C156.073,190.332,161.406,184.383,164.048,178.518ZM224.8,157.181c-5.192,0-11.537,1.225-18.862,3.641l-1.437.474.093,1.51c.44,7.1.977,16.382,1.229,25.189l.54,17.867c.148,5.419.3,8.86.388,10.158l.163,2.446L221.975,214l-.155-1.608c-.511-5.333-.873-10.539-1.1-15.882,12.145-9.237,18.053-17.967,18.053-26.664a21.747,21.747,0,0,0-.418-3.98C237.568,161.894,234.586,157.181,224.8,157.181Zm16.222,41.393,14.535.738.15-1.9a106.2,106.2,0,0,1,2.945-18.217c.858-3.427,2.581-9.034,5.431-17.666l.722-2.185-20.628-3.324Z"/><path d="M252.442,13.2l-2.6,93.882-.158,5.724,5.394-1.919,88.485-31.482L286.28,153.831l-3.492,4.537,5.492,1.618,90.09,26.54-90.09,26.541-5.492,1.618,3.492,4.537,57.285,74.425L255.08,262.165l-5.394-1.919.158,5.723,2.6,93.883-53.081-77.48-3.236-4.723-3.235,4.723-53.081,77.48,2.6-93.883.158-5.723-5.394,1.919L48.686,293.647l57.285-74.425,3.492-4.537-5.492-1.618-90.09-26.541,90.09-26.54,5.492-1.618-3.492-4.537L48.686,79.406l88.485,31.482,5.394,1.919-.158-5.724-2.6-93.882,53.081,77.48,3.235,4.723,3.236-4.723L252.442,13.2M167.407,165c-.906-3.86-4.131-9.779-15.374-9.779-5.4,0-11.954,1.258-19.477,3.74l-2.873.947.187,3.02c.439,7.089.976,16.352,1.226,25.131l.539,17.852c.149,5.432.3,8.909.391,10.237l.323,4.9,4.706-1.4,11.166-3.31,3.1-.919-.309-3.216c-.475-4.955-.821-9.805-1.052-14.763A67.918,67.918,0,0,0,160.9,187.085l0,.064a45.468,45.468,0,0,0,3.881,21.027c4.962,11.08,12.515,13.406,17.978,13.406,7.671,0,14-4.382,18.824-13.021a46.325,46.325,0,0,0,2.725-5.787l.094,3.136c.149,5.452.3,8.924.392,10.24l.327,4.894,4.7-1.4,11.164-3.31,3.1-.919-.308-3.216c-.476-4.96-.822-9.809-1.052-14.762,12.113-9.409,18.009-18.451,18.009-27.6a23.746,23.746,0,0,0-.459-4.377c-.753-3.827-3.766-10.248-15.475-10.248-5.4,0-11.953,1.258-19.477,3.739l-2.873.948.187,3.02q.049.8.1,1.633c-4.942-9.442-11.92-11.5-17.052-11.5-7.392,0-13.535,4.014-18.274,11.935m89.949,36.368.3-3.8a104.3,104.3,0,0,1,2.9-17.914c.841-3.361,2.553-8.924,5.387-17.509l1.442-4.37-4.543-.732L246.6,154.423l-4.22-.68-.316,4.263-2.849,38.421-.3,4,4.01.2,10.626.539,3.807.194m-17.466,19.59a11.316,11.316,0,0,0,5.986,1.664,14.133,14.133,0,0,0,2.058-.157,15.243,15.243,0,0,0,7.435-3.3l.053-.043.051-.045a10.782,10.782,0,0,0,3.968-8.273,9.064,9.064,0,0,0-4.551-7.953,11.709,11.709,0,0,0-6.272-1.74,15.5,15.5,0,0,0-1.695.1l-.07.008-.07.01a14.694,14.694,0,0,0-7.524,3.445l-.042.036-.041.037a10.943,10.943,0,0,0-3.826,8.216,8.856,8.856,0,0,0,4.54,7.994M256.732,0,196.125,88.464,135.519,0l2.967,107.192L37.457,71.247l65.405,84.976L0,186.526l102.862,30.3-65.4,84.977,101.029-35.945-2.967,107.192,60.606-88.464,60.607,88.464-2.967-107.192,101.029,35.945-65.4-84.977,102.862-30.3-102.862-30.3,65.4-84.976L253.765,107.192,256.732,0ZM182.755,217.659c-6.314,0-11.088-3.695-14.4-11.087a41.335,41.335,0,0,1-3.542-19.249A43.063,43.063,0,0,1,170.2,168c4.081-7.314,9.24-11.01,15.477-11.01s11.087,3.7,14.4,11.087a41.692,41.692,0,0,1,3.542,19.249,44.13,44.13,0,0,1-5.467,19.326c-4.081,7.315-9.163,11.01-15.4,11.01Zm70.993-20.4-10.626-.539,2.849-38.421,16.246,2.618c-2.695,8.161-4.542,14.09-5.467,17.786a107.346,107.346,0,0,0-3,18.556ZM208.7,215.889c-.077-1.155-.231-4.466-.385-10.086l-.539-17.863c-.231-8.085-.693-16.555-1.232-25.255,7.238-2.388,13.32-3.542,18.248-3.542,6.852,0,10.7,2.386,11.627,7.083a20.05,20.05,0,0,1,.385,3.619c0,8.161-6.006,16.708-18.094,25.717.23,5.774.615,11.395,1.154,17.016L208.7,215.889Zm-72.764,0c-.076-1.155-.23-4.466-.384-10.086l-.539-17.863c-.231-8.085-.693-16.555-1.232-25.255,7.237-2.388,13.32-3.542,18.248-3.542,6.853,0,10.7,2.386,11.626,7.083a19.872,19.872,0,0,1,.385,3.619c0,8.161-6.005,16.708-18.094,25.717.232,5.774.616,11.395,1.155,17.016l-11.165,3.311ZM245.876,218.7a7.345,7.345,0,0,1-3.985-1.116,4.922,4.922,0,0,1-2.619-4.619,7.007,7.007,0,0,1,2.541-5.313,10.794,10.794,0,0,1,5.544-2.541,11.449,11.449,0,0,1,1.261-.073,7.726,7.726,0,0,1,4.205,1.152,5.15,5.15,0,0,1,2.7,4.619,6.841,6.841,0,0,1-2.619,5.312,11.34,11.34,0,0,1-5.543,2.465,10.061,10.061,0,0,1-1.481.114Z"/></g></svg> </div> </div> </div>
Put to SVGs in the same wrapping element. Hide one, show the other using CSS, then swap the class name for the POP. <div class="initialBalloon swingimage"> <svg id="Balloon_1" data-name="Balloon_1".../></svg> <svg id="Pop1" class="hideme" data-name="Pop_1".../></svg> </div> .hideme { display:none }
You can add pop div into the theTurtle div and add below css changes. .theTurtle{ position:relative; } .pop { position: absolute; opacity: 0; top: 0; left: 50px; width: 100px; transform: translateX(0vw) translateY(0vw); animation: pow 1s linear 19s 1 none; } I have changed top to -10px and left to 50px of .pop class style. See the Snippet below: html { box-sizing:border-box; } *, *:before, *:after { /* allow all elements to inherit box-sizing */ box-sizing: inherit; } html, body { margin:0; padding:0; overflow:hidden; width: 100vw; height: 100vh; } .BalloonContainer { position: absolute; overflow: hidden; top: 0; right: 0; left: 0; bottom: 0; } .flying img { max-width: 150px; position: absolute; top: 20px; transform: translateX(-30vw); animation: moveBird 2s linear 16.9s 1 forwards; } #-webkit-keyframes moveBird { 0% { transform: translateX(-30vw) rotate(3deg); } 50% { transform: rotate(-3deg); } 100% { transform: translateX(45vw) rotate(3deg); } } .initialBalloon { position: absolute; /* moves initial position before animating */ transform: translateX(100vw); top: 150px; animation: moveFirst 2s linear .2s 1; width: 150px; } .firstBalloon { position: absolute; transform: translateX(-30vw); top: 150px; animation: move 5s linear 5s infinite; width: 150px; } .secondBalloon { position: absolute; transform: translateX(-30vw); top: 200px; animation: move 8s linear 0s infinite; width: 150px; } .thirdBalloon { top: 250px; transform: translateX(-30vw); position: absolute; animation: move 11s linear 1s infinite; width: 150px; } .turtle { position: absolute; top: 50px; transform: translateX(-50vw); opacity: 1; animation: moveTurtle 5s linear 1s 1 none, moveTurtleStop 11s linear 6s 1 forwards, moveTurtleRotate 5s linear 17s infinite forwards, hideOpacity 1s linear 19s 1 forwards; width: 250px; } .theTurtle{ position:relative; } .pop { position: absolute; opacity: 0; top: -10px; left: 50px; width: 100px; transform: translateX(0vw) translateY(0vw); animation: pow 1s linear 19s 1 none; } #-webkit-keyframes pow { 0% { transform: scale(0); opacity: 0; } 50% { transform: scale(1); opacity: 1; } 100% { transform: scale(0); opacity: 0; } } #-webkit-keyframes hideOpacity { 0% { opacity: 1; } 100% { opacity: 0; } } #-webkit-keyframes moveTurtle { 0% { transform: translateX(-50vw) rotate(10deg); } 50% { transform: rotate(-5deg); } 100% { transform: translateX(100vw) rotate(10deg); } } #-webkit-keyframes moveTurtleRotate { 0% { transform: translateX(50vw) rotate(10deg); } 50% { transform: translateX(50vw) rotate(-5deg); } 100% { transform: translateX(50vw) rotate(10deg); } } #-webkit-keyframes moveTurtleStop { 0% { transform: translateX(-50vw) rotate(10deg); } 50% { transform: rotate(-5deg); } 100% { transform: translateX(50vw) rotate(10deg); } } #-webkit-keyframes move { 0% { transform: translateX(-30vw) rotate(10deg); } 50% { transform: rotate(-5deg); } 100% { transform: translateX(100vw) rotate(10deg); } } #-webkit-keyframes moveFirst { 0% { transform: translateX(50vw) rotate(10deg); } 50% { transform: translateX(75vw) rotate(-5deg); } 100% { transform: translateX(100vw) rotate(10deg); } } #-webkit-keyframes fade-in { 0% { opacity: 0; visibility: hidden; } 100% { opacity: 1; visibility: visible; } } #keyframes fade-in { 0% { opacity: 0; visibility: hidden; } 100% { opacity: 1; visibility: visible; } } #-webkit-keyframes fade-out { 0% { opacity: 1; visibility: visible; } 100% { opacity: 0; visibility: hidden; } } #keyframes fade-out { 0% { opacity: 1; visibility: visible; } 100% { opacity: 0; visibility: hidden; } } <div class="BalloonContainer"> <div class="flying"> <img src="https://williamcunningham.me/happy_birthday_2019/img/flyNew.gif" alt=""> </div> <div class="initialBalloon swingimage"> <svg id="Balloon_1" data-name="Balloon_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48.82 125.26"><defs><style>.cls-1{fill:#606060;}</style></defs><title>Balloon_1</title><path class="cls-1" d="M15.34,1.26s-18,9-15,26,19,28,19,28a22.69,22.69,0,0,0,4,1c1,0-2,2-1,3h5s2,0-1-3c0,0,18-6,22-28S30.34-3.74,15.34,1.26Zm-4,25h-6c-2-14,13-20,13-20C8.34,14.26,11.34,26.26,11.34,26.26Z" transform="translate(0 0)"/><polygon id="string_1" class="cls-1" points="22.34 125.26 24.41 57.26 25.57 57.26 26.34 125.26 22.34 125.26"/></svg> </div> <div class="firstBalloon swingimage"> <svg id="Balloon_2" data-name="Balloon_2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48.82 125.26"><defs><style>.cls-1{fill:#606060;}</style></defs><title>Balloon_2</title><path class="cls-1" d="M15.34,1.26s-18,9-15,26,19,28,19,28a22.69,22.69,0,0,0,4,1c1,0-2,2-1,3h5s2,0-1-3c0,0,18-6,22-28S30.34-3.74,15.34,1.26Zm-4,25h-6c-2-14,13-20,13-20C8.34,14.26,11.34,26.26,11.34,26.26Z" transform="translate(0 0)"/><polygon id="string_2" class="cls-1" points="22.34 125.26 24.41 57.26 25.57 57.26 26.34 125.26 22.34 125.26"/></svg> </div> <div class="secondBalloon swingimage"> <svg id="Balloon_3" data-name="Balloon_3" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48.82 125.26"><defs><style>.cls-1{fill:#606060;}</style></defs><title>Balloon_3</title><path class="cls-1" d="M15.34,1.26s-18,9-15,26,19,28,19,28a22.69,22.69,0,0,0,4,1c1,0-2,2-1,3h5s2,0-1-3c0,0,18-6,22-28S30.34-3.74,15.34,1.26Zm-4,25h-6c-2-14,13-20,13-20C8.34,14.26,11.34,26.26,11.34,26.26Z" transform="translate(0 0)"/><polygon id="string_3" class="cls-1" points="22.34 125.26 24.41 57.26 25.57 57.26 26.34 125.26 22.34 125.26"/></svg> </div> <div class="thirdBalloon swingimage"> <svg id="Balloon_4" data-name="Balloon_4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48.82 125.26"><defs><style>.cls-1{fill:#606060;}</style></defs><title>Balloon_4</title><path class="cls-1" d="M15.34,1.26s-18,9-15,26,19,28,19,28a22.69,22.69,0,0,0,4,1c1,0-2,2-1,3h5s2,0-1-3c0,0,18-6,22-28S30.34-3.74,15.34,1.26Zm-4,25h-6c-2-14,13-20,13-20C8.34,14.26,11.34,26.26,11.34,26.26Z" transform="translate(0 0)"/><polygon id="string_4" class="cls-1" points="22.34 125.26 24.41 57.26 25.57 57.26 26.34 125.26 22.34 125.26"/></svg> </div> <div class="theTurtle"> <div class="turtle swingimage"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104.826 171.637"><defs><style>.cls-1{fill:#171618;}</style></defs><title>turtleandBalloon</title><g id="balloonTotalMain"><polygon id="stringMain" class="cls-1" points="38.5 121.946 40.57 53.946 41.734 53.946 42.5 121.946 38.5 121.946"/><path id="bPiece_8" class="cls-1" d="M37.608,52.314a3.2,3.2,0,0,1-2.537-1.509c-.841-1.122-1.6-2.316-2.265-3.37a24.353,24.353,0,0,0-1.788-2.6,6.229,6.229,0,0,1-1.745,2.484l-.7.654-.648-.71a45.517,45.517,0,0,1-8.488-12.955l-.348-.83.809-.394a23.644,23.644,0,0,1,9.887-2.607,12.738,12.738,0,0,1,4.482.772c4,1.5,5.27,2.77,6.29,3.79.873.873,1.45,1.45,4.006,1.876.5.083.929.151,1.3.21,1.876.3,2.508.4,2.745,1.171.221.72-.294,1.2-.839,1.713a13.461,13.461,0,0,0-2.547,3.1c-.435.725-.871,1.5-1.306,2.266C41.9,48.942,39.989,52.314,37.608,52.314Z" transform="translate(0)"/><path id="bPiece_7" class="cls-1" d="M38.771,58.327l-.279-.279c-.919-.919-.351-2.028.211-2.8-.253-.061-.549-.137-.9-.233l.09-1.855a5.7,5.7,0,0,0,3.762-2.436c-.478-.6-.793-2.114,4.926-7.832l1.16-1.16,2.668,9.782-.553.384A32.485,32.485,0,0,1,44.6,54.89c.84,1.045,1.077,1.831.791,2.523a1.563,1.563,0,0,1-1.464.914Z" transform="translate(0)"/><path id="bPiece_6" class="cls-1" d="M51.541,49.085c-.379-.864-.777-1.619-1.128-2.286-.8-1.521-1.379-2.619-1.035-3.688a2.327,2.327,0,0,1,1.264-1.347c.459-.229.4-.843-.021-2.573a13.811,13.811,0,0,1-.506-3.24A2.445,2.445,0,0,1,52.726,33.2c1.515,0,3.662.811,6.313,1.871a11.3,11.3,0,0,0,2.344.675l1.216.2-.5,1.127a35.34,35.34,0,0,1-9.059,12.35l-.976.855Z" transform="translate(0)"/><path id="bPiece_5" class="cls-1" d="M60.97,34.233c-2.069,0-6.1-2.761-7.838-5.371-.727-1.091-1.157-1.8-.853-2.507a1.522,1.522,0,0,1,1.3-.8,2.591,2.591,0,0,0,1.58-.749c.641-.641.641-.641-.076-1.757a21.183,21.183,0,0,1-2.039-3.882,3.453,3.453,0,0,1,.01-3.3,3.4,3.4,0,0,1,3.023-1.233,11.437,11.437,0,0,1,2.373.288l3.905-3.255.546,1.049a23.4,23.4,0,0,1,1.962,15.318,41.07,41.07,0,0,1-1.216,4.934l-.186.593-.617.068a1.511,1.511,0,0,0-.634.153,1.684,1.684,0,0,1-1.236.458Z" transform="translate(0)"/><path id="bPiece_4" class="cls-1" d="M46.6,35.438c-1.948,0-4.19-1.226-5.673-2.037-.295-.161-.553-.3-.763-.407-1.261-.631-1.955-2.074-1.955-4.065a13.4,13.4,0,0,1,1.529-5.782c.814-1.629-.922-3.439-3.464-5.816-1.451-1.357-2.822-2.639-3.253-3.931a2.483,2.483,0,0,1,.348-2.318c1.137-1.577,4-2.149,5.644-2.149a3.255,3.255,0,0,1,2.188.577,1.147,1.147,0,0,0,.256.023,9.438,9.438,0,0,0,6.85-4.478,4.728,4.728,0,0,1,3.6-2.272l.315-.061.288.141a24.215,24.215,0,0,1,6.837,4.955l.9.944-1.176.571c-1.184.575-1.776,2.35-2.348,4.066-1.1,3.3-1.5,3.456-6.43,4.442-1.9.379-1.529,3.177-.75,7.4.463,2.51.941,5.106.545,7.087A3.418,3.418,0,0,1,46.6,35.438Z" transform="translate(0)"/><path id="bPiece_3" class="cls-1" d="M34.744,6.628a41.641,41.641,0,0,1-6.839-.642l-2.144-.361,1.72-1.33a31.067,31.067,0,0,1,4.592-3l.061-.031.065-.021A25.071,25.071,0,0,1,40.14,0a28.537,28.537,0,0,1,9.942,1.811L53.227,3l-3.3.642c-1.9.37-3.83.872-5.7,1.358a61.208,61.208,0,0,1-6.356,1.429A22.338,22.338,0,0,1,34.744,6.628Z" transform="translate(0)"/><path id="bPiece_2" class="cls-1" d="M38.856,35.344c-.626,0-1.353-.411-2.681-1.518s-3.576-1.674-6.669-1.674A44.457,44.457,0,0,0,19.948,33.4l-.815.184-.288-.784a33.419,33.419,0,0,1-1.565-5.73C15.311,15.914,22.554,8.23,27.046,4.643l.438-.349L28,4.507A4.327,4.327,0,0,1,29.954,5.9l.226.33L30.1,6.62c-.044.219-1.12,5.364-5.463,6.45-.446.111-.889.623-1.283,1.478-1.8,3.91-1.525,12.217-.953,13.36a1.188,1.188,0,0,0,.594.1c2.022,0,5.736-1.887,6.272-2.958.376-.751.376-3.224.376-5.406,0-2.592,0-5.273.524-6.848.128-.384.518-1.552,1.537-1.552,1.628,0,2.087,3.241,2.194,4.346.242.154.708.39,1.1.587,1.764.893,4.431,2.242,5.082,4.5a4.177,4.177,0,0,1-.573,3.388c-1.186,1.976-.366,5.247.176,7.411.441,1.757.683,2.725.156,3.4A1.219,1.219,0,0,1,38.856,35.344Z" transform="translate(0)"/><path id="bPiece_1" class="cls-1" d="M37.808,55.018c-.941-.262-1.8-.548-1.8-.548l-.128-.043-.111-.076a50.878,50.878,0,0,1-7.848-7.087l-.636-.7.691-.643a4.436,4.436,0,0,0,1.24-1.706c.42-1.258,1.124-1.522,1.642-1.522,1.2,0,2.089,1.4,3.558,3.719.648,1.024,1.382,2.185,2.178,3.246.256.341.64.748,1.014.748,1.27,0,3.222-3.454,4.647-5.976.444-.784.887-1.569,1.331-2.308a14.855,14.855,0,0,1,2.4-3.051c-.137-.023-1.237-.2-1.74-.281-3.158-.526-4.03-1.4-5.04-2.408-.889-.889-2-2-5.612-3.352a10.807,10.807,0,0,0-3.813-.651A21.766,21.766,0,0,0,20.728,34.8l-.905.442-.39-.929c-.207-.494-.4-1-.588-1.508l-.376-1.019,1.059-.239a46.388,46.388,0,0,1,9.978-1.295c3.551,0,6.2.711,7.888,2.115.267.222.49.4.676.539-.072-.314-.158-.655-.235-.965-.619-2.469-1.555-6.2.038-8.855a2.327,2.327,0,0,0,.376-1.879c-.421-1.458-2.642-2.582-4.112-3.325-1.318-.667-2.113-1.069-2.113-1.923a8.684,8.684,0,0,0-.262-1.607,40.322,40.322,0,0,0-.214,5.3c0,2.739,0,5.1-.577,6.258C30,27.839,25.462,29.914,23,29.914a2.31,2.31,0,0,1-2.3-1.155c-.927-1.855-1-10.818.927-15.006a4.087,4.087,0,0,1,2.55-2.53c2.516-.63,3.591-3.374,3.931-4.5a3.714,3.714,0,0,0-.827-.458l-1.5-.615,1.7-1.357.331-.257.412.07a39.9,39.9,0,0,0,6.522.614A20.471,20.471,0,0,0,37.6,4.539,60.105,60.105,0,0,0,43.75,3.152c1.9-.494,3.861-1,5.814-1.384l.265-.051.252.094c.829.311,1.648.666,2.434,1.052l2.538,1.248-2.776.541a3.006,3.006,0,0,0-2.262,1.255,11.139,11.139,0,0,1-8.554,5.53,2.1,2.1,0,0,1-1.541-.522l0,0a4.733,4.733,0,0,0-.9-.08c-1.507,0-3.513.546-4.1,1.359a.6.6,0,0,0-.086.6c.278.835,1.533,2.008,2.746,3.143,2.4,2.242,5.381,5.032,3.867,8.058-1.769,3.539-1.644,6.683-.426,7.292.228.114.507.267.825.441,1.234.674,3.3,1.8,4.76,1.8.68,0,1.348-.191,1.626-1.579.324-1.622-.121-4.035-.551-6.368-.764-4.142-1.629-8.838,2.249-9.613,4.22-.844,4.22-.844,5-3.177.7-2.091,1.417-4.252,3.323-5.177l.624-.3.48.5A21.346,21.346,0,0,1,62.9,12.709l.354.681-4.342,3.618-.485-.137a9.989,9.989,0,0,0-2.351-.34c-.737,0-1.278.148-1.446.4s-.106.812.181,1.53a19.3,19.3,0,0,0,1.872,3.558c.865,1.345,1.548,2.407-.178,4.134a4.325,4.325,0,0,1-2.1,1.178c.082.13.184.288.31.477,1.525,2.287,5.061,4.521,6.252,4.524a3.07,3.07,0,0,1,1.661-.6l1.451-.162-.437,1.393A38.8,38.8,0,0,1,62.1,37.067l-.3.673-.726-.119a13.148,13.148,0,0,1-2.744-.786C56.046,35.921,53.9,35.1,52.726,35.1c-.47,0-.706,0-.706.851a12.127,12.127,0,0,0,.452,2.792c.428,1.772.913,3.779-.979,4.725-.215.108-.291.193-.3.227a6.142,6.142,0,0,0,.907,2.217c.366.7.78,1.482,1.187,2.407l.281.638-.525.461a36.019,36.019,0,0,1-3.18,2.483l-1.107.767-1.973-7.233a20.392,20.392,0,0,0-3.406,4.381,1.666,1.666,0,0,1,.125,1.4c-.465,1.477-2.694,3.363-5.271,3.818l-.213.038ZM27.559,25a21.326,21.326,0,0,1,2.882-14.059c-3.465,2.727-7.247,7.3-6.617,14.059Z" transform="translate(0)"/></g><g id="turtleMain"><path id="turtleBody" class="cls-1" d="M103.914,147.832a37.959,37.959,0,0,0-6.666-6.665s-1.9-2.857-6.665-1.905-9.522,2.857-7.617.953,1.9-2.857-.953-2.857c-.952,0-17.139-15.235-27.613-17.139s-11.426-2.857-19.043-2.857c0,0-17.14-.952-31.422,19.044,0,0-4.761.952-3.809,3.809s7.617,7.617,5.713,10.474-6.665,8.569-3.809,11.426S16.313,156.4,16.313,156.4s17.139,11.426,39.039.952c0,0,1.905,0,1.905,3.809s-.952,10.474,1.9,10.474,9.522-11.427,9.522-11.427,3.809-3.808.952-6.665c0,0-1.9-1.9-.952-2.856s6.665-5.713,10.474-.953,3.809,6.666,9.522,6.666,13.33-2.857,13.33-2.857S106.77,151.641,103.914,147.832Zm-99.027-8.57s24.756,34.279,72.366,0C77.253,139.262,32.5,180.206,4.887,139.262Zm88.077,11.427a4.285,4.285,0,1,1,4.284-4.285A4.285,4.285,0,0,1,92.964,150.689Z" transform="translate(0)"/><circle id="eyeballMain" class="cls-1" cx="94.392" cy="145.928" r="0.952"/></g></svg> <div class="pop"> <svg id="pop" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 392.251 373.053"><defs><style>.cls-1{fill:#ed2f2f;}</style></defs><title>pop</title><g id="letterHole"><path class="cls-1" d="M220.443,178.854c0-.954,0-1.871.024-2.806a12.231,12.231,0,0,1,3.405-.7c.088,0,.165,0,.232.007a9.469,9.469,0,0,1-2.129,2.623,15.561,15.561,0,0,1-1.532,1.409Z"/><path d="M223.872,173.387a17.568,17.568,0,0,0-5.312,1.232c-.078,1.463-.078,2.849-.078,4.235v4.157a19,19,0,0,0,4.851-3.618c1.925-1.848,2.849-3.311,2.849-4.389s-.77-1.617-2.31-1.617Z"/></g><g id="letterHole2"><path class="cls-1" d="M185.6,202.994a5.2,5.2,0,0,1-4.975-2.978,13.791,13.791,0,0,1-1.3-7.053,29.148,29.148,0,0,1,2.318-9.742c1.072-2.529,2.863-5.563,5.27-5.563,1.763,0,3.206,1.741,4.29,5.174a27.584,27.584,0,0,1,1.22,9.251,16.944,16.944,0,0,1-1.916,7.463C188.859,202.6,187.021,202.994,185.6,202.994Z"/><path d="M186.912,179.619c.729,0,1.7,1.529,2.406,3.757a25.656,25.656,0,0,1,1.145,8.608,15.057,15.057,0,0,1-1.691,6.646c-1.194,2.217-2.262,2.4-3.168,2.4a3.247,3.247,0,0,1-3.233-1.92,11.947,11.947,0,0,1-1.087-6.067A27.1,27.1,0,0,1,183.441,184c1.145-2.7,2.476-4.384,3.471-4.384m0-3.922c-2.771,0-5.158,2.233-7.083,6.775a30.95,30.95,0,0,0-2.464,10.395,15.692,15.692,0,0,0,1.54,8.084,7.122,7.122,0,0,0,6.7,4c2.848,0,5-1.463,6.622-4.466a18.974,18.974,0,0,0,2.155-8.315,29.434,29.434,0,0,0-1.309-9.933c-1.385-4.388-3.465-6.544-6.16-6.544Z"/></g><g id="letterHole3"><path class="cls-1" d="M147.681,178.854c0-.954,0-1.871.023-2.806a12.237,12.237,0,0,1,3.405-.7c.088,0,.165,0,.233.007a9.5,9.5,0,0,1-2.13,2.623,15.419,15.419,0,0,1-1.531,1.408Z"/><path d="M151.109,173.387a17.586,17.586,0,0,0-5.313,1.232c-.076,1.463-.076,2.849-.076,4.235v4.157a19.012,19.012,0,0,0,4.85-3.618c1.925-1.848,2.849-3.311,2.849-4.389s-.771-1.617-2.31-1.617Z"/></g><g id="full"><path class="cls-1" d="M196.125,281.119l-58.461,85.333,2.861-103.4L43.071,297.727l63.092-81.97L6.94,186.526l99.223-29.23L43.071,75.326,140.525,110,137.664,6.6l58.461,85.333L254.587,6.6,251.726,110l97.453-34.674-63.09,81.97,99.222,29.23-99.223,29.231,63.091,81.97-97.453-34.674,2.861,103.4Zm52.493-78.044a13.514,13.514,0,0,0-1.477.085,12.807,12.807,0,0,0-6.6,3,8.95,8.95,0,0,0-3.224,6.8,6.883,6.883,0,0,0,3.615,6.327,9.169,9.169,0,0,0,4.949,1.369,12.26,12.26,0,0,0,1.769-.134,13.325,13.325,0,0,0,6.49-2.881,8.808,8.808,0,0,0,3.344-6.837,7.092,7.092,0,0,0-3.636-6.295A9.641,9.641,0,0,0,248.618,203.075Zm-84.57-24.557a47.259,47.259,0,0,0-1.193,8.718,43.558,43.558,0,0,0,3.716,20.148c3.635,8.116,9.081,12.236,16.184,12.236,6.906,0,12.664-4.043,17.112-12.016a46.244,46.244,0,0,0,5.712-20.171,43.941,43.941,0,0,0-3.711-20.161c-3.639-8.126-9.087-12.247-16.187-12.247-6.957,0-12.741,4.043-17.19,12.017a44.035,44.035,0,0,0-2.729,5.858,19.435,19.435,0,0,0,.243-3.055,21.653,21.653,0,0,0-.418-3.981c-.781-3.97-3.763-8.683-13.554-8.683-5.192,0-11.538,1.225-18.862,3.641l-1.437.474.093,1.51c.441,7.1.979,16.388,1.229,25.189l.54,17.867c.147,5.4.3,8.845.387,10.156l.162,2.449L149.212,214l-.154-1.608c-.511-5.328-.873-10.534-1.1-15.882C156.073,190.332,161.406,184.383,164.048,178.518ZM224.8,157.181c-5.192,0-11.537,1.225-18.862,3.641l-1.437.474.093,1.51c.44,7.1.977,16.382,1.229,25.189l.54,17.867c.148,5.419.3,8.86.388,10.158l.163,2.446L221.975,214l-.155-1.608c-.511-5.333-.873-10.539-1.1-15.882,12.145-9.237,18.053-17.967,18.053-26.664a21.747,21.747,0,0,0-.418-3.98C237.568,161.894,234.586,157.181,224.8,157.181Zm16.222,41.393,14.535.738.15-1.9a106.2,106.2,0,0,1,2.945-18.217c.858-3.427,2.581-9.034,5.431-17.666l.722-2.185-20.628-3.324Z"/><path d="M252.442,13.2l-2.6,93.882-.158,5.724,5.394-1.919,88.485-31.482L286.28,153.831l-3.492,4.537,5.492,1.618,90.09,26.54-90.09,26.541-5.492,1.618,3.492,4.537,57.285,74.425L255.08,262.165l-5.394-1.919.158,5.723,2.6,93.883-53.081-77.48-3.236-4.723-3.235,4.723-53.081,77.48,2.6-93.883.158-5.723-5.394,1.919L48.686,293.647l57.285-74.425,3.492-4.537-5.492-1.618-90.09-26.541,90.09-26.54,5.492-1.618-3.492-4.537L48.686,79.406l88.485,31.482,5.394,1.919-.158-5.724-2.6-93.882,53.081,77.48,3.235,4.723,3.236-4.723L252.442,13.2M167.407,165c-.906-3.86-4.131-9.779-15.374-9.779-5.4,0-11.954,1.258-19.477,3.74l-2.873.947.187,3.02c.439,7.089.976,16.352,1.226,25.131l.539,17.852c.149,5.432.3,8.909.391,10.237l.323,4.9,4.706-1.4,11.166-3.31,3.1-.919-.309-3.216c-.475-4.955-.821-9.805-1.052-14.763A67.918,67.918,0,0,0,160.9,187.085l0,.064a45.468,45.468,0,0,0,3.881,21.027c4.962,11.08,12.515,13.406,17.978,13.406,7.671,0,14-4.382,18.824-13.021a46.325,46.325,0,0,0,2.725-5.787l.094,3.136c.149,5.452.3,8.924.392,10.24l.327,4.894,4.7-1.4,11.164-3.31,3.1-.919-.308-3.216c-.476-4.96-.822-9.809-1.052-14.762,12.113-9.409,18.009-18.451,18.009-27.6a23.746,23.746,0,0,0-.459-4.377c-.753-3.827-3.766-10.248-15.475-10.248-5.4,0-11.953,1.258-19.477,3.739l-2.873.948.187,3.02q.049.8.1,1.633c-4.942-9.442-11.92-11.5-17.052-11.5-7.392,0-13.535,4.014-18.274,11.935m89.949,36.368.3-3.8a104.3,104.3,0,0,1,2.9-17.914c.841-3.361,2.553-8.924,5.387-17.509l1.442-4.37-4.543-.732L246.6,154.423l-4.22-.68-.316,4.263-2.849,38.421-.3,4,4.01.2,10.626.539,3.807.194m-17.466,19.59a11.316,11.316,0,0,0,5.986,1.664,14.133,14.133,0,0,0,2.058-.157,15.243,15.243,0,0,0,7.435-3.3l.053-.043.051-.045a10.782,10.782,0,0,0,3.968-8.273,9.064,9.064,0,0,0-4.551-7.953,11.709,11.709,0,0,0-6.272-1.74,15.5,15.5,0,0,0-1.695.1l-.07.008-.07.01a14.694,14.694,0,0,0-7.524,3.445l-.042.036-.041.037a10.943,10.943,0,0,0-3.826,8.216,8.856,8.856,0,0,0,4.54,7.994M256.732,0,196.125,88.464,135.519,0l2.967,107.192L37.457,71.247l65.405,84.976L0,186.526l102.862,30.3-65.4,84.977,101.029-35.945-2.967,107.192,60.606-88.464,60.607,88.464-2.967-107.192,101.029,35.945-65.4-84.977,102.862-30.3-102.862-30.3,65.4-84.976L253.765,107.192,256.732,0ZM182.755,217.659c-6.314,0-11.088-3.695-14.4-11.087a41.335,41.335,0,0,1-3.542-19.249A43.063,43.063,0,0,1,170.2,168c4.081-7.314,9.24-11.01,15.477-11.01s11.087,3.7,14.4,11.087a41.692,41.692,0,0,1,3.542,19.249,44.13,44.13,0,0,1-5.467,19.326c-4.081,7.315-9.163,11.01-15.4,11.01Zm70.993-20.4-10.626-.539,2.849-38.421,16.246,2.618c-2.695,8.161-4.542,14.09-5.467,17.786a107.346,107.346,0,0,0-3,18.556ZM208.7,215.889c-.077-1.155-.231-4.466-.385-10.086l-.539-17.863c-.231-8.085-.693-16.555-1.232-25.255,7.238-2.388,13.32-3.542,18.248-3.542,6.852,0,10.7,2.386,11.627,7.083a20.05,20.05,0,0,1,.385,3.619c0,8.161-6.006,16.708-18.094,25.717.23,5.774.615,11.395,1.154,17.016L208.7,215.889Zm-72.764,0c-.076-1.155-.23-4.466-.384-10.086l-.539-17.863c-.231-8.085-.693-16.555-1.232-25.255,7.237-2.388,13.32-3.542,18.248-3.542,6.853,0,10.7,2.386,11.626,7.083a19.872,19.872,0,0,1,.385,3.619c0,8.161-6.005,16.708-18.094,25.717.232,5.774.616,11.395,1.155,17.016l-11.165,3.311ZM245.876,218.7a7.345,7.345,0,0,1-3.985-1.116,4.922,4.922,0,0,1-2.619-4.619,7.007,7.007,0,0,1,2.541-5.313,10.794,10.794,0,0,1,5.544-2.541,11.449,11.449,0,0,1,1.261-.073,7.726,7.726,0,0,1,4.205,1.152,5.15,5.15,0,0,1,2.7,4.619,6.841,6.841,0,0,1-2.619,5.312,11.34,11.34,0,0,1-5.543,2.465,10.061,10.061,0,0,1-1.481.114Z"/></g></svg> </div> </div> <!-- POW --> </div> </div>
Animate a rotating tooltip without rotating text itself (CSS)
I would like to create a tooltip which consists of a line that rotates around an icon when hovered, as the diagram below shows. Rotation part is not difficult, but I am having trouble getting the text to stay parallel to the page. Any help, if possible with an example, would be much appreciated. The closest I have come up with is: html, body { height: 100%; margin: 0; } body { display: flex; align-items: center; background-color: black; color: white; } svg { width: 256px; height: 256px; } svg > g { transform: translate(128px, 128px); } #ticks > line { stroke: white; } #hands { stroke: white; stroke-width: 4px; transform: rotate(-90deg); } #second, .label { animation: handrotation 40s infinite alternate; } .label { transform-origin: -100px; position: relative; left: 50px; } #second > line { stroke: white; stroke-width: 1px; stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: dash 8s forwards; } #keyframes dash { to { stroke-dashoffset: 00; } } #keyframes handrotation { to { transform: rotate(0.1turn); } } <svg version="1.1" xmlns="http://www.w3.org/2000/svg"> <g> <g id="second"> <line x1="-12" y1="0" x2="120" y2="0"/> </g> <span class="label">label</span> </g> </g> </svg>
Animating svg fill from bottom to top
I have a simple layout: split screen, one section is white, the other is black. centered logo, half black and half white when you hover the black section, it gets filled from bottom to top with white Now, what I try to do: Fill the logo from bottom to top with black when I hover the section on the right. Fill the logo from top to bottom with white when I hover the section on the left I tried many things... but I always failed. I think the easiest solution would be to have a rectangle with a linear gradient as a background-image, add a mask and then move the background-position. Here is a snippet: $( document ).ready(function() { $(".split-half").hover(function(){ var elem = $(this); $(".split-half").each(function(){ $(this).removeClass('active'); setTimeout(function(){ elem.addClass('active'); }, 400); }); }); }); body *, *:after, *:before { box-sizing: border-box; margin:0; padding:0; } html, body { height: 100%; } .split-half { display: block; width: 50%; height: 100%; position: absolute; z-index: 1; padding: 5%; } .split-half:nth-child(1) { background: #fff; left: 0; } .split-half:nth-child(1):after { content: ''; width: 100%; height: 0; position: absolute; top: 0; left: 0; background: #000; transition: height .3s; } .split-half:nth-child(1).active:hover:after { height: 100%; z-index: -1; } .split-half:nth-child(2) { background: #000; right: 0; } .split-half:nth-child(2):after { content: ''; width: 100%; height: 0; position: absolute; bottom: 0; left: 0; background: #fff; transition: height .3s; } .split-half:nth-child(2).active:hover:after { height: 100%; z-index: -1; } .split-half:nth-child(2).active:hover + #logo #rect { background-position: 0% 100%; } #logo { position: absolute; top: 50%; left: 50%; transform: translate(-39.8%, -50%); max-width: 420px; min-width: 120px; width: 10%; height: auto; z-index: 10; } #logo #rect { background-image: linear-gradient(to bottom, white 0%, white 50%, black 50%, black 100%); background-position: 0% 0%; background-size: 100% 200%; height: 100%; width: 100%; transition: all .3s; mask: url(#mhSvg); position: absolute; top: 0; right: 0; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <section> <div class="split-half"></div> <div class="split-half"> </div> <div id="logo"> <svg width="100%" height="100%" viewBox="0 0 187 174" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"> <defs> <g id="hSvg"> <path d="M74.624,173.782l111.609,-55.886l-24.82,-12.41l-24.82,12.41l-24.82,-12.41l24.82,-12.41l-24.82,-12.41l-111.773,55.804l24.984,12.492l61.969,-31.066l24.82,12.41l-61.969,31.066" style="fill:#fff;"/> </g> <mask id="mhSvg" x="0" y="0" width="100%" height="100%"> <g id="hSvg"> <path d="M74.624,173.782l111.609,-55.886l-24.82,-12.41l-24.82,12.41l-24.82,-12.41l24.82,-12.41l-24.82,-12.41l-111.773,55.804l24.984,12.492l61.969,-31.066l24.82,12.41l-61.969,31.066" style="fill:#fff;"/> </g> </mask> <g id="aSvg"> <path d="M0.082,0l74.542,37.271l0,136.511l-24.82,-12.41l0,-62.05l-24.902,-12.451l0,62.05l-24.82,-12.41l0,-136.511Zm24.902,62.091l0,-24.82l24.82,12.41l0,24.821l-24.82,-12.411Z"/> </g> </defs> <g> <use xlink:href="#hSvg" x="0" y="0" /> <use xlink:href="#aSvg" x="0" y="0" /> </g> </svg> <div id="rect"> </div> </div> </section> For now, as you can see, I fail to position the mask. Do you know how I can position the mask ? Or do you think of a better method to achieve the effect ? Thank you in advance ! Edit: Well, I found a solution with masks... but it won't be a good solution as it's not cross browsers. $( document ).ready(function() { $(".split-half").hover(function(){ var elem = $(this); $(".split-half").each(function(){ $(this).removeClass('active'); setTimeout(function(){ elem.addClass('active'); }, 400); }); }); }); /* line 3, ../sass/style.scss */ body *, *:after, *:before { box-sizing: border-box; } html, body { height: 100%; margin:0; padding: 0; } .split-half { display: block; width: 50%; height: 100%; position: absolute; z-index: 1; padding: 5%; } .split-half:nth-child(1) { background: #fff; left: 0; } .split-half:nth-child(1):after { content: ''; width: 100%; height: 0; position: absolute; top: 0; left: 0; background: #000; transition: height .3s; } .split-half:nth-child(1).active:hover:after { height: 100%; z-index: -1; } .split-half:nth-child(1).active:hover ~ #logo #A { background-position: 0% 0%; } .split-half:nth-child(2) { background: #000; right: 0; } .split-half:nth-child(2):after { content: ''; width: 100%; height: 0; position: absolute; bottom: 0; left: 0; background: #fff; transition: height .3s; } .split-half:nth-child(2).active:hover:after { height: 100%; z-index: -1; } /* line 58, ../sass/style.scss */ .split-half:nth-child(2).active:hover + #logo #H { background-position: 0% 100%; } #logo { position: absolute; top: 50%; left: 50%; transform: translate(-38.5%, -50%); z-index: 10; } #logo #H { background-image: linear-gradient(to bottom, white 0%, white 50%, black 50%, black 100%); background-position: 0% 0%; background-size: 100% 200%; height: 100%; width: 100%; transition: all .3s; mask: url(#mhSvg); position: absolute; top: 0; right: 0; } #logo #A { background-image: linear-gradient(to bottom, white 0%, white 50%, black 50%, black 100%); background-position: 0% 100%; background-size: 100% 200%; height: 100%; width: 100%; transition: all .3s; mask: url(#maSvg); position: absolute; top: 0; right: 0; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <section> <div class="split-half"></div> <div class="split-half"> </div> <div id="logo"> <svg width="194" height="181" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"> <defs> <g id="hSvg"> <path d="M74.624,173.782l111.609,-55.886l-24.82,-12.41l-24.82,12.41l-24.82,-12.41l24.82,-12.41l-24.82,-12.41l-111.773,55.804l24.984,12.492l61.969,-31.066l24.82,12.41l-61.969,31.066" style="fill:#fff;"/> </g> <mask id="mhSvg" x="0" y="0" width="120" height="114"> <g id="hSvg"> <path d="M74.624,173.782l111.609,-55.886l-24.82,-12.41l-24.82,12.41l-24.82,-12.41l24.82,-12.41l-24.82,-12.41l-111.773,55.804l24.984,12.492l61.969,-31.066l24.82,12.41l-61.969,31.066" style="fill:#fff;"/> </g> </mask> <mask id="maSvg" x="0" y="0" width="120" height="114"> <g id="aSvg"> <path d="M0.082,0l74.542,37.271l0,136.511l-24.82,-12.41l0,-62.05l-24.902,-12.451l0,62.05l-24.82,-12.41l0,-136.511Zm24.902,62.091l0,-24.82l24.82,12.41l0,24.821l-24.82,-12.411Z" style="fill:#fff"/> </g> </mask> </defs> <g> </svg> <div id="H"> </div> <div id="A"> </div> </div> </section> I may have to dig at the suggestion made by #RobertLongson that is to say animate the stops of a linear-gradient. Edit 2: I tried animating the linear-gradient position, thanks to kute.js. It works in firefox, chrome, but not in IE/Edge or on the website, they do have an exemple working on IE/Edge. Here is my pen, I'm still wondering why it doesn't work. https://codepen.io/AmauryH/pen/brBgKo
Here's one way to do it. I'm using an animated CSS linear-gradient for the split-half <div> elements. And using mix-blend-mode: difference to ensure the logo contrasts with the animated background. This should work on all browsers except IE/Edge. body *, *:after, *:before { box-sizing: border-box; margin:0; padding:0; } html, body { height: 100%; } .split-half { display: block; width: 50%; height: 100%; position: absolute; z-index: 1; padding: 5%; } .split-half:nth-child(1) { background: linear-gradient(to top, #ffffff 50%,#000000 50%); background-size: 100% 200%; background-position: 0 100%; left: 0; transition: background-position 0.5s; } .split-half:nth-child(1):hover { background-position: 0 0; } .split-half:nth-child(2) { background: linear-gradient(to top, #ffffff 50%,#000000 50%); background-size: 100% 200%; right: 0; transition: background-position 0.5s; } .split-half:nth-child(2):hover { background-position: 0 100%; } #logo { position: absolute; top: 50%; left: 50%; transform: translate(-39.8%, -50%); max-width: 420px; min-width: 120px; width: 10%; height: auto; z-index: 10; mix-blend-mode: difference; } <section> <div class="split-half"></div> <div class="split-half"></div> <div id="logo"> <svg width="100%" height="100%" viewBox="0 0 187 174" style="fill-rule:evenodd;"> <defs> <linearGradient x1="0" y1="100%" x2="0" y2="0"> <stop offset="0" stop-color="white"/> <stop offset="0" stop-color="black"/> </linearGradient> </defs> <g> <path id="hSvg" d="M74.624,173.782l111.609,-55.886l-24.82,-12.41l-24.82,12.41l-24.82,-12.41l24.82,-12.41l-24.82,-12.41l-111.773,55.804l24.984,12.492l61.969,-31.066l24.82,12.41l-61.969,31.066" style="fill:#fff;"/> <path id="aSvg" d="M0.082,0l74.542,37.271l0,136.511l-24.82,-12.41l0,-62.05l-24.902,-12.451l0,62.05l-24.82,-12.41l0,-136.511Zm24.902,62.091l0,-24.82l24.82,12.41l0,24.821l-24.82,-12.411Z" style="fill:#fff;"/> </g> </svg> </div> </section>
I've finally decided to start from a blank page and went for a different approach. A container with a linear-gradient background (half white/half black) and the logo as a svg background-image Two more containers inside with height 0. One with a black background, the other with a white background In each a fullscreen span with the logo as a background image. (one logo full black, the other full white) Then, I just have to animate the height of the containers from 0 to 100% to get the transition I wanted. To get the white background to fill the screen from bottom to top, I had to use a simple trick... I've rotated the container with the background from a 180deg angle, and I've rotated it's children with the same angle. Here is a snippet: var vHeight = $(window).height(); var vWidth = $(window).width(); var screen1 = $('#screen1'); var currentMousePos = { x: -1, y: -1 }; $(document).mousemove(function(event) { currentMousePos.x = event.pageX; currentMousePos.y = event.pageY; if ( currentMousePos.y <= vHeight ){ if ( currentMousePos.x >= ((vWidth / 2) + (vWidth / 10)) ) { $('.svgb-wrapper').css('height', '0'); $('.svgw-wrapper').css('height', '100%'); } else if ( currentMousePos.x <= ((vWidth / 2) - (vWidth / 10)) ) { $('.svgb-wrapper').css('height', '100%'); $('.svgw-wrapper').css('height', '0'); } else { $('.svgb-wrapper').css('height', '0'); $('.svgw-wrapper').css('height', '0'); } }; }); * { margin:0; padding:0; border:0; } body *, *:after, *:before { box-sizing: border-box; } html, body { height: 100%; background: #000; color: #fff; } #screen1 { height: 100%; background: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMTg3IDE3NCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW\a 5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3BhY2U9InByZXNlcnZlIiBzdHlsZT0iZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7c3Ryb2tlLWxpbmVqb2lu\aOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjEuNDE0MjE7Ij48cmVjdCBpZD0iUGxhbi1kZS10cmF2YWlsMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjE4Ni4zNjgiIGhlaWdodD0iMTczLjc4MiIgc3R5bG\aU9ImZpbGw6bm9uZTsiLz48Y2xpcFBhdGggaWQ9Il9jbGlwMSI+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjE4Ni4zNjgiIGhlaWdodD0iMTczLjc4MiIvPjwvY2xpcFBhdGg+PGcgY2xpcC1wYXRo\aPSJ1cmwoI19jbGlwMSkiPjxwYXRoIGlkPSJoU3ZnIiBkPSJNNzQuNjI0LDE3My43ODJsMTExLjYwOSwtNTUuODg2bC0yNC44MiwtMTIuNDFsLTI0LjgyLDEyLjQxbC0yNC44MiwtMTIuNDFsMjQuOD\aIsLTEyLjQxbC0yNC44MiwtMTIuNDFsLTExMS43NzMsNTUuODA0bDI0Ljk4NCwxMi40OTJsNjEuOTY5LC0zMS4wNjZsMjQuODIsMTIuNDFsLTYxLjk2OSwzMS4wNjYiIHN0eWxlPSJmaWxsOiNmZmY7\aIi8+PHBhdGggaWQ9ImFTdmciIGQ9Ik0wLjA4MiwwbDc0LjU0MiwzNy4yNzFsMCwxMzYuNTExbC0yNC44MiwtMTIuNDFsMCwtNjIuMDVsLTI0LjkwMiwtMTIuNDUxbDAsNjIuMDVsLTI0LjgyLC0xMi\a 40MWwwLC0xMzYuNTExbDAsMFptMjQuOTAyLDYyLjA5MWwwLC0yNC44MmwyNC44MiwxMi40MWwwLDI0LjgyMWwtMjQuODIsLTEyLjQxMWwwLDBaIi8+PC9nPjwvc3ZnPg==") no-repeat left 55% center, linear-gradient(to right, #ffffff 0%, #ffffff 50%, #000000 50%, #000000 100%); background-size: 33%, cover; } #screen1 .svgw-wrapper { height: 0; width: 100%; overflow: hidden; position: absolute; top: 0; -moz-transition: all 0.6s; -o-transition: all 0.6s; -webkit-transition: all 0.6s; transition: all 0.6s; background: #000; } #screen1 .svgw-wrapper .svgw { position: absolute; top: 0; display: block; height: 100vh; width: 100%; background: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PCF\a ET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy\a 53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHdpZHRoPSIxMDAlI\aiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCAxODcgMTc0IiB2ZXJzaW9uPSIxLjEiIHhtbG5z\aPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzM\aub3JnLzE5OTkveGxpbmsiIHhtbDpzcGFjZT0icHJlc2VydmUiIHN0eWxlPSJmaWxsLXJ1bGU6ZX\aZlbm9kZDtjbGlwLXJ1bGU6ZXZlbm9kZDtzdHJva2UtbGluZWpvaW46cm91bmQ7c3Ryb2tlLW1pd\aGVybGltaXQ6MS40MTQyMTsiPjxyZWN0IGlkPSJQbGFuLWRlLXRyYXZhaWwxIiB4PSIwIiB5PSIw\aIiB3aWR0aD0iMTg2LjM2OCIgaGVpZ2h0PSIxNzMuNzgyIiBzdHlsZT0iZmlsbDpub25lOyIvPjx\ajbGlwUGF0aCBpZD0iX2NsaXAxIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMTg2LjM2OCIgaG\aVpZ2h0PSIxNzMuNzgyIi8+PC9jbGlwUGF0aD48ZyBjbGlwLXBhdGg9InVybCgjX2NsaXAxKSI+P\aHBhdGggaWQ9ImhTdmciIGQ9Ik03NC42MjQsMTczLjc4MmwxMTEuNjA5LC01NS44ODZsLTI0Ljgy\aLC0xMi40MWwtMjQuODIsMTIuNDFsLTI0LjgyLC0xMi40MWwyNC44MiwtMTIuNDFsLTI0LjgyLC0\axMi40MWwtMTExLjc3Myw1NS44MDRsMjQuOTg0LDEyLjQ5Mmw2MS45NjksLTMxLjA2NmwyNC44Mi\awxMi40MWwtNjEuOTY5LDMxLjA2NiIgc3R5bGU9ImZpbGw6I2ZmZjsiLz48cGF0aCBpZD0iYVN2Z\ayIgZD0iTTAuMDgyLDBsNzQuNTQyLDM3LjI3MWwwLDEzNi41MTFsLTI0LjgyLC0xMi40MWwwLC02\aMi4wNWwtMjQuOTAyLC0xMi40NTFsMCw2Mi4wNWwtMjQuODIsLTEyLjQxbDAsLTEzNi41MTFsMCw\awWm0yNC45MDIsNjIuMDkxbDAsLTI0LjgybDI0LjgyLDEyLjQxbDAsMjQuODIxbC0yNC44MiwtMT\aIuNDExbDAsMFoiIHN0eWxlPSJmaWxsOiNmZmY7Ii8+PC9nPjwvc3ZnPg==") no-repeat left 55% center; background-size: 33%; } #screen1 .svgb-wrapper { height: 0; width: 100%; overflow: hidden; position: absolute; bottom: 0; background: #fff; -moz-transition: all 0.6s; -o-transition: all 0.6s; -webkit-transition: all 0.6s; transition: all 0.6s; -moz-transform: rotateX(180deg); -ms-transform: rotateX(180deg); -webkit-transform: rotateX(180deg); transform: rotateX(180deg); } #screen1 .svgb-wrapper .svgb { position: absolute; top: 0; display: block; height: 100vh; width: 100%; background: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMTg3IDE3NCIgdmV\ayc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW\a 5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3BhY2U9InByZXNlcnZlIiBzd\aHlsZT0iZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7c3Ryb2tlLWxpbmVqb2lu\aOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjEuNDE0MjE7Ij48cmVjdCBpZD0iUGxhbi1kZS10cmF\a 2YWlsMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjE4Ni4zNjgiIGhlaWdodD0iMTczLjc4MiIgc3R5bG\aU9ImZpbGw6bm9uZTsiLz48Y2xpcFBhdGggaWQ9Il9jbGlwMSI+PHJlY3QgeD0iMCIgeT0iMCIgd\a 2lkdGg9IjE4Ni4zNjgiIGhlaWdodD0iMTczLjc4MiIvPjwvY2xpcFBhdGg+PGcgY2xpcC1wYXRo\aPSJ1cmwoI19jbGlwMSkiPjxwYXRoIGlkPSJoU3ZnIiBkPSJNNzQuNjI0LDE3My43ODJsMTExLjY\awOSwtNTUuODg2bC0yNC44MiwtMTIuNDFsLTI0LjgyLDEyLjQxbC0yNC44MiwtMTIuNDFsMjQuOD\aIsLTEyLjQxbC0yNC44MiwtMTIuNDFsLTExMS43NzMsNTUuODA0bDI0Ljk4NCwxMi40OTJsNjEuO\aTY5LC0zMS4wNjZsMjQuODIsMTIuNDFsLTYxLjk2OSwzMS4wNjYiLz48cGF0aCBpZD0iYVN2ZyIg\aZD0iTTAuMDgyLDBsNzQuNTQyLDM3LjI3MWwwLDEzNi41MTFsLTI0LjgyLC0xMi40MWwwLC02Mi4\awNWwtMjQuOTAyLC0xMi40NTFsMCw2Mi4wNWwtMjQuODIsLTEyLjQxbDAsLTEzNi41MTFsMCwwWm\a 0yNC45MDIsNjIuMDkxbDAsLTI0LjgybDI0LjgyLDEyLjQxbDAsMjQuODIxbC0yNC44MiwtMTIuN\a DExbDAsMFoiLz48L2c+PC9zdmc+") no-repeat left 55% center; background-size: 33%; -moz-transform: rotateX(180deg); -ms-transform: rotateX(180deg); -webkit-transform: rotateX(180deg); transform: rotateX(180deg); } #screen2 { -moz-transition: all 0.6s; -o-transition: all 0.6s; -webkit-transition: all 0.6s; transition: all 0.6s; } <script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.2.0/zepto.min.js"></script> <section id="screen1"> <div class="svgw-wrapper"> <span class="svgw"></span> </div> <div class="svgb-wrapper"> <span class="svgb"></span> </div> </section> It's a cross browser solution. The only problem is the background-position and the background-size that are not working as expected in IE, but I'll probably live with that !