πŸ”΅ CSS - Keyframe

jea_iΒ·2022λ…„ 2μ›” 7일
0
post-thumbnail
<body>
    <h2>Keyframe μ•Œμ•„λ³΄κΈ°</h2>
    <div class="box"></div>
    <ul class="progress">
        <li></li>
    </ul>
</body>

<style>
/* λΈŒλΌμš°μ € ꡬ뢄 없이 ν‘œμ€€λ°©μ‹, w3cμ—μ„œ κΆŒκ³ ν•¨ */
@keyframes{}
/* λ²€ν„°ν”„λ¦¬ν”½μŠ€ : λΈŒλΌμš°μ € μ œμ‘°μ‚¬λ₯Ό κ΅¬λΆ„ν•˜λŠ” μ½”λ“œ, λΈŒλΌμš°μ €λ§ˆλ‹€ 속성을 μ²˜λ¦¬ν•˜λŠ” 방식이 달라 각 λΈŒλΌμš°μ €μ— λ§žλŠ” 속성을 λ³„λ„λ‘œ μž‘μ„±ν•΄μ•Ό ν•©λ‹ˆλ‹€. */
/* OperaλΈŒλΌμš°μ € , λŒ€λΆ€λΆ„ λͺ¨λ°”μΌμ „μš© λΈŒλΌμš°μ € */
@-o-keyframes{}
/* Micro Softd의 μ΅μŠ€ν”Œλ‘œμ–΄ */
@-ms-keyframes{}
/* Mozilla의 Fire Fox */
@-moz-keyframes{}
/* Webkit엔지 기반, 크둬, μ‚¬νŒŒλ¦¬, 엣지 λ“±λ“± */
@-webkit-keyframes{}


@keyframes myAni{
    0%{
        width: 200px;
        height: 200px;
        transform: rotate(0deg);
    }
    50%{
        width: 400px;
        width: 400px;
        transform: rotate(180deg);
    }
    100%{
        width: 200px;
        height: 200px;
        transform: rotate(0deg);
    }
}



.box{
    width: 300px; height: 300px;
    background-color: #99f;
    transition-property: width, background-color;
    transition-duration: 0.3s;
    /* κ΅¬μ„±λœ ν‚€ν”„λ ˆμž„μ˜ 이름 */
    animation-name: myAni;
    /* ν‚€ν”„λ ˆμž„μ΄ μž‘λ™λ˜λŠ” μ‹œκ°„ */
    animation-duration: 3s;
    /* ν‚€ν”„λ ˆμž„μ˜ 반볡 횟수 , infinite; λ¬΄ν•œλ°˜λ³΅*/
    animation-iteration-count: infinite;
    /* μΌμ‹œμ •μ§€ */
    animation-play-state: paused;
}
.box:hover{
    width: 400px;
}
.box:active{
    background-color: #f00;
}

@keyframes myProg{
    0%{
        width: 0%;
    }
    100%{
        width: 90%;
    }
}
.progress{
    padding: 0; margin: 0; list-style: none;
    width: 600px;
    background-color: #ccc;
    border-radius: 10px;
}
.progress li{
    width: 1000%;
    height: 30px;
    background-color: #f60;
    border-radius: 20px;
    border: 4px solid #ccc;
    box-sizing: border-box;
    animation-name: myProg;
    animation-duration: 3s;
    /* 100%κ°„ λ‹€μŒ 정지 */
    animation-fill-mode: forwards;
    /* linear(속도일정) | ease-in(가속) | ease-out(감속) */
    //animation-timing-function: cubic-bezier(0,2.03,1,-0.65);
}
</style>
profile
μ—΄μ •μ—΄μ •μ—΄μ •πŸ”₯

0개의 λŒ“κΈ€

κ΄€λ ¨ μ±„μš© 정보