Is there a way to pause an animation at the 50% mark for 2 seconds and then resume?
P.S. The setInterval method is not recommended!
function pauseAnimation() {
document.getElementById("0").style.animationPlayState = "paused";
};
var pauseInterval = setInterval(pauseAnimation, 2200);
function resumeAnimation() {
document.getElementById("0").style.animationPlayState = "running";
};
var resumeInterval = setInterval(resumeAnimation, 2600);
@keyframes FourthBallStarting {
0% {
offset-distance: 0%;
visibility: hidden;
transform: rotateZ(0);
opacity: 0;
}
12.5%{
offset-distance: 3%;
opacity: 1.0;
visibility: visible;
}
50% {
transform: scaleY(3);
}
90% {
offset-distance: 23%;
opacity: 1;
visibility: visible;
}
99%,100% {
offset-distance: 25%;
visibility: hidden;
transform: rotateZ(-90deg);
opacity: 0;
}
}
.ball {
position: absolute;
width: 150px;
height: 150px;
z-index: 1;
border-radius: 50%;
border: 1px solid black;
animation-fill-mode: forwards;
offset-path: path("M445 1.5C503.241 1.5 560.912 12.9715 614.72 35.2594C668.528 57.5474 717.419 90.2154 758.602 131.398C799.785 172.581 832.453 221.472 854.741 275.28C877.029 329.088 888.5 386.759 888.5 445C888.5 503.241 877.029 560.912 854.741 614.72C832.453 668.528 799.785 717.419 758.602 758.602C717.419 799.785 668.528 832.453 614.72 854.741C560.912 877.029 503.241 888.5 445 888.5C386.759 888.5 329.088 877.028 275.28 854.741C221.472 832.453 172.581 799.785 131.398 758.602C90.2152 717.419 57.5473 668.528 35.2593 614.72C12.9714 560.912 1.49997 503.241 1.5 445C1.50003 386.759 12.9715 329.088 35.2595 275.28C57.5475 221.472 90.2155 172.581 131.398 131.398C172.581 90.2152 221.472 57.5473 275.28 35.2593C329.088 12.9714 386.759 1.49996 445 1.5L445 1.5Z");
margin-left: -70px;
}
<div id="SpinningImages" class="SpinningImages">
</div>
<div id="BigCircle" >
</div>
</div>
`
var image = document.createElement("IMG");
image.setAttribute("src", imgArray[0].src);
image.classList.add("ball");
image.setAttribute("id", "0");
image.setAttribute("style", "animation: FourthBallStarting 2s linear normal infinite;");
image.setAttribute("alt", "Image");
image.style.animationFillMode = "forwards";
document.getElementById("SpinningImages").appendChild(image);
`