Я учусь делать анимацию в CSS. Я знаю, что могу установить свойство iteration-count
на бесконечность, и оно будет работать бесконечно, но я хочу, чтобы цикл был плавным. После возврата к 0% в ключевом кадре анимация не будет гладкой и мгновенно изменится на это свойство. Я хочу, чтобы переход от 100% к 0% был плавным, если это имеет смысл.
Это мой HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>CSS Animations</title>
</head>
<body>
<div id="shape"></div>
</body>
</html>
Это мой CSS
*
{
margin:0px;
padding:0px;
}
body
{
display: flex;
justify-content: center;
align-items: center;
height:100vh;
}
#shape
{
background-color: red;
width:100px;
height:100px;
border-radius:50%;
border:0px;
animation-name:color-function;
animation-duration: 5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-fill-mode: forwards;
}
@keyframes color-function
{
0%
{
background-color: red;
height:100px;
border-radius: 50%;
}
25%
{
background-color: yellow;
height:100px;
border-radius: 50%;
}
50%
{
background-color: blue;
height:100px;
border-radius: 50%;
}
75%
{
background-color: green;
height:100px;
border-radius: 50%;
}
100%
{
background-color: red;
height:150px;
border-radius: 0%;
}
}
Спасибо