2.8 KiB
2.8 KiB
id, title, challengeType, videoUrl, forumTopicId, localeTitle
id | title | challengeType | videoUrl | forumTopicId | localeTitle |
---|---|---|---|---|---|
587d78a8367417b2b2512ae3 | Animate Elements Continually Using an Infinite Animation Count | 0 | https://scrimba.com/c/cVJDVfq | 301041 | Анимация элементов, постоянно использующих бесконечный подсчет анимации |
Description
@keyframes
. Другим свойством анимации является animation-iteration-count
, который позволяет вам контролировать, сколько раз вы хотели бы прокручивать анимацию. Вот пример: animation-iteration-count: 3;
В этом случае анимация остановится после запуска 3 раза, но можно сделать анимацию непрерывной, установив это значение в бесконечное.
Instructions
animation-iteration-count
на бесконечность.
Tests
tests:
- text: The <code>animation-iteration-count</code> property should have a value of infinite.
testString: assert($('#ball').css('animation-iteration-count') == 'infinite');
Challenge Seed
<style>
#ball {
width: 100px;
height: 100px;
margin: 50px auto;
position: relative;
border-radius: 50%;
background: linear-gradient(
35deg,
#ccffff,
#ffcccc
);
animation-name: bounce;
animation-duration: 1s;
animation-iteration-count: 3;
}
@keyframes bounce{
0% {
top: 0px;
}
50% {
top: 249px;
width: 130px;
height: 70px;
}
100% {
top: 0px;
}
}
</style>
<div id="ball"></div>
Solution
<style>
#ball {
width: 100px;
height: 100px;
margin: 50px auto;
position: relative;
border-radius: 50%;
background: linear-gradient(
35deg,
#ccffff,
#ffcccc
);
animation-name: bounce;
animation-duration: 1s;
animation-iteration-count: infinite;
}
@keyframes bounce{
0% {
top: 0px;
}
50% {
top: 249px;
width: 130px;
height: 70px;
}
100% {
top: 0px;
}
}
</style>
<div id="ball"></div>