코드랩 레퍼런스
animation-iteration-count 본문
특징 | 설명 |
---|---|
기본 값 | 1 |
상속 | 안됨 |
애니메이션 | 안됨 |
버전 | CSS3 |
Definition
- animation-iteration-count 속성은 애니메이션 반복 횟수 설정합니다.
Syntax
Property
속성 값 | 설명 |
---|---|
number | 애니메이션 반복 횟수를 숫자를 통해 설정합니다. |
infinite | 애니메이션 반복 횟수를 무한으로 설정합니다. |
inherit | 애니메이션반복 횟수를 상위 요소한테 상속받습니다. |
Compatibility
6 | 7 | 8 | 9 | 10 | 11 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
animation-iteration-count |
Sample1 클릭하면 이미지가 움직이는 횟수를 확인하는 예제입니다.
애니메이션(animation-iteration-count)
- .list div.count {animation: move1 2s ease; animation-iteration-count:1;}
- .list div.count {animation: move1 2s ease; animation-iteration-count:2;}
- .list div.count {animation: move1 2s ease; animation-iteration-count:3;}
- .list div.count {animation: move1 2s ease; animation-iteration-count:infinite;}
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>CSS</title>
<style>
.list > div {width: 60px; height: 60px; background-image: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); line-height: 60px; text-align: center; border-radius: 50%;font-size: 12px; color: #fff; margin: 10px; position: relative;}
.list div.count1 {animation: move1 2s ease; animation-iteration-count:1;}
.list div.count2 {animation: move1 2s ease; animation-iteration-count:2;}
.list div.count3 {animation: move1 2s ease; animation-iteration-count:3;}
.list div.count4 {animation: move1 2s ease; animation-iteration-count:infinite;}
@keyframes move1 {
0% {left: 0%;}
50% {left: calc(100% - 70px);}
100% {left: 0%;}
}
</style>
</head>
<body>
<h3 class="h3">애니메이션(animation-iteration-count)</h3>
<div class="list">
<div>count</div>
<div>count</div>
<div>count</div>
<div>count</div>
</div>
<div class="btn">
<a href="#c" class="line">Click : 클릭하면 이미지가 움직입니다.</a><br><br>
<ul>
<li>.list div.count {animation: move1 2s ease; animation-iteration-count:1;}</li>
<li>.list div.count {animation: move1 2s ease; animation-iteration-count:2;}</li>
<li>.list div.count {animation: move1 2s ease; animation-iteration-count:3;}</li>
<li>.list div.count {animation: move1 2s ease; animation-iteration-count:infinite;}</li>
</ul>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script type="text/javascript">
$(".btn a").click(function(){
$(".list > div").eq(0).addClass("count1");
$(".list > div").eq(1).addClass("count2");
$(".list > div").eq(2).addClass("count3");
$(".list > div").eq(3).addClass("count4");
});
</script>
</body>
</html>