Я пытаюсь разработать анимацию в стиле зацикленного игрового автомата в CSS, но я не уверен, как сделать так, чтобы она плавно переходила.
.scrollable {
height: 150px;
width: 150px;
margin: 0 auto;
padding: 0;
background: #000;
overflow: hidden;
}
.items {
-webkit-animation: scroll 5s infinite;
-moz-animation: scroll 5s infinite;
-ms-animation: scroll 5s infinite;
}
.number {
color: #ffffff;
font-size: 36px;
padding-bottom: 28px;
position: relative;
top: 20px;
}
@-webkit-keyframes scroll {
0% {
margin-top: 0;
}
27.33% {
margin-top: 0;
}
33.33% {
margin-top: -50px;
}
60.66% {
margin-top: -50px;
}
66.66% {
margin-top: -100px;
}
94.99% {
margin-top: -100px;
}
100% {
margin-top: 0;
}
}
@-moz-keyframes scroll {
0% {
margin-top: 0;
}
27.33% {
margin-top: 0;
}
33.33% {
margin-top: -50px;
}
60.66% {
margin-top: -50px;
}
66.66% {
margin-top: -100px;
}
94.99% {
margin-top: -100px;
}
100% {
margin-top: 0;
}
}
@-ms-keyframes scroll {
0% {
margin-top: 0;
}
27.33% {
margin-top: 0;
}
33.33% {
margin-top: -50px;
}
60.66% {
margin-top: -50px;
}
66.66% {
margin-top: -100px;
}
94.99% {
margin-top: -100px;
}
100% {
margin-top: 0;
}
}
<div class="scrollable">
<div class="items">
<div class="number">1</div>
<div class="number">2</div>
<div class="number">3</div>
<div class="number">1</div>
<div class="number">2</div>
</div>
</div>
Как я могу сделать так, чтобы он перешел так, чтобы он казался бесконечным циклом, в отличие от возврата к началу, как сейчас?Также, как я могу заставить цикл остановиться через определенное время, скажем, 30 секунд?