웹프로그래밍 CSS3/CSS 애니메이션
애니메이션 6
별초롱언니
2025. 3. 18. 17:48
▣ 커튼을 치고 걷어내는 듯한 효과 만들기
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>커튼을 치고 걷어내는 듯한 효과 만들기</title>
<style>
div {
width: 100px;
height: 100px;
position: absolute;
animation-duration: 5s;
animation-timing-function: linear;
animation-delay: 2s;
animation-iteration-count: infinite;
animation-play-state: running;
}
#box1 {
background-color: blue;
animation-direction: normal;
animation-name: L-box;
}
#box2 {
background-color: yellow;
animation-direction: reverse;
animation-name: R-box;
}
@keyframes L-box {
0% {
left: 0px;
}
50% {
left: 200px;
}
100% {
left: 0px;
}
}
@keyframes R-box {
0% {
left: 400px;
}
50% {
left: 200px;
}
100% {
left: 400px;
}
}
</style>
</head>
<body>
<div id="box1"> 왼쪽 박스</div>
<div id="box2"> 오른쪽 박스</div>
</body>
</html>
See the Pen Untitled by byeolchorong (@byeolchorong) on CodePen.