코드랩 레퍼런스
animation-duration 본문
특징 | 설명 |
---|---|
기본 값 | 0s |
상속 | 안됨 |
애니메이션 | 안됨 |
버전 | CSS3 |
Definition
- animation-duration 속성은 애니메이션 움직임 시간을 설정합니다.
Syntax
Property
속성 값 | 설명 |
---|---|
time | 애니메이션의 작동 시간을 설정합니다. |
inherit | 애니메이션 작동 시간을 상위 요소한테 상속받습니다. |
Compatibility
6 | 7 | 8 | 9 | 10 | 11 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
animation-duration |
Sample1 클릭하면 이미지 지속 시간을 설정하는 예제입니다.
애니메이션(Animation-duration)
- .list div.duration1 {animation: move1 1s 10 ease; animation-duration : 1s;}
- .list div.duration2 {animation: move1 1s 10 ease; animation-duration : 2s;}
- .list div.duration3 {animation: move1 1s 10 ease; animation-duration : 3s;}
- .list div.duration4 {animation: move1 1s 10 ease; animation-duration : 4s;}
<!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.duration1 {animation: move1 1 ease; animation-duration : 1s;}
.list div.duration2 {animation: move1 1 ease; animation-duration : 2s;}
.list div.duration3 {animation: move1 1 ease; animation-duration : 3s;}
.list div.duration4 {animation: move1 1 ease; animation-duration : 4s;}
@keyframes move1 {
0% {left: 0%;}
50% {left: calc(100% - 70px);}
100% {left: 0%;}
}
</style>
</head>
<body>
<h3 class="h3">애니메이션(Animation-duration)</h3>
<div class="list">
<div>duration</div>
<div>duration</div>
<div>duration</div>
<div>duration</div>
</div>
<div class="btn">
<a href="#c" class="line">Click : 클릭하면 이미지가 움직입니다.</a>
<ul>
<li>.list div.duration1 {animation: move1 1s 10 ease; animation-duration : 1s;}</li>
<li>.list div.duration2 {animation: move1 1s 10 ease; animation-duration : 2s;}</li>
<li>.list div.duration3 {animation: move1 1s 10 ease; animation-duration : 3s;}</li>
<li>.list div.duration4 {animation: move1 1s 10 ease; animation-duration : 4s;}</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("duration1");
$(".list > div").eq(1).addClass("duration2");
$(".list > div").eq(2).addClass("duration3");
$(".list > div").eq(3).addClass("duration4");
});
</script>
</body>
</html>