πΊ left / transform μ°¨μ΄
κΈ°νμλ λμμ΄λ μꡬμ¬νμ λ°λΌ μ λλ§€μ΄μ μ λ£μ΄μΌ νλ κ²½μ°κ° μλ€. μ΄λ²μ μ λλ©μ΄μ μ΄ λ²λ² μΈλ€λ λ§μ΄ λμκ³ , μ λλ©μ΄μ μ μλ μ νμν€λ μμκ° leftμλ€λ κ²μ λ°κ²¬νμλ€.
κ°λ¨νκ² leftκ° 0 => 100px νλ λͺ¨μ΅μ λ§λ€μ΄λ³΄μλ€.
πΉοΈ leftλ₯Ό μ΄μ©ν μ λλ©μ΄μ

μμ κ°μ΄ λ§λ€μμλμ λ¨μ μ΄ μ‘΄μ¬νμλ€. λ¨μ μ μ λλ©μ΄μ μ infinite(무νλ°λ³΅) μμΌ°μλ 리λ λλ§μ΄ λκ³ μμλ€.

κ°λ¨ν leftλ₯Ό μ΄μ©ν css μ½λμ΄λ€.
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Animation1</title>
<link rel="stylesheet" href="./src/styles/animation1.css">
</head>
<body>
<div class="container">
<div class="circle left-animation">
</div>
</div>
</body>
</html>
css
.container {
position: relative;
display: inline-block;
width: 100%;
height: 100px;
}
.circle {
display: inline-block;
width: 100px;
height: 100px;
background-color: aqua;
border-radius: 50%;
position: absolute;
left: 0;
top: 0;
}
.left-animation {
animation-delay: 250ms;
animation-direction: normal;
animation-duration: 3s;
animation-iteration-count: infinite;
animation-name: leftanimation;
}
@keyframes leftanimation {
from {
left: 0;
}
to {
left: 100px;
}
}
πͺ transformμ μ΄μ©ν μ λλ©μ΄μ
μ΄λ²μλ transformμ μ΄μ©νμ¬ μ λλ§€μ΄μ μ λ§λ€μ΄λ³΄μλ€.


μλλ transformμ μ΄μ©ν html,css μ½λμ΄λ€
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Animation1</title>
<link rel="stylesheet" href="./src/styles/animation1.css">
</head>
<body>
<div class="container">
<div class="circle2 transform-animation">
</div>
</div>
</body>
</html>
css
.container {
position: relative;
display: inline-block;
width: 100%;
height: 100px;
}
.circle2 {
display: inline-block;
width: 100px;
height: 100px;
background-color: black;
border-radius: 50%;
position: absolute;
top: 0;
left: 0;
}
.transform-animation {
animation-delay: 250ms;
animation-direction: normal;
animation-duration: 3s;
animation-iteration-count: infinite;
animation-name: transformanimation;
}
@keyframes transformanimation {
from {
transform: translateX(0);
}
to {
transform: translateX(200px);
}
}
β±οΈ λ λλ§ κ³Όμ μ ν΅ν css μ±λ₯ μκΈ°
λ λλ§ κ³Όμ μ "νμ± = > λ μ΄μμ => νμΈνΈ => Composite" μ΄ μΌμ΄λλ€. μ¬κΈ°μ μ λλ§€μ΄μ μμ "left" λ₯Ό μ¬μ©νλ€λ©΄
"λ μ΄μμ => νμΈνΈ => Composite"μ΄ λ°λ³΅ν΄μ μΌμ΄λλ€. λ§μ½ μ λλ§€μ΄μ μ 무νλ°λ³΅(infinite) μν¬ κ²½μ°μλ "λ μ΄μμ => νμΈνΈ => Composite" κ³μν΄μ 무νλ°λ³΅ κ³Όμ μ΄ μΌμ΄λλ©°, λΈλΌμ°μ μ±λ₯μ΄ μ νλ μ μλ€.
κ·Έλ¬λ―λ‘ κ°κΈμ μ΄λ©΄ μ λλ§€μ΄μ μμλ "left,top,width,height λ±λ±" κ°μ μμ± λ³΄λ€λ "transform" μμ±μ μ΄μ©νλκ² λ«λ€
'css' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
| π« css animation μ±λ₯ λΉκ΅ (5) | 2023.06.22 |
|---|
λκΈ