๐Ÿ”ธ Keyframe

forStudingยท2022๋…„ 1์›” 5์ผ
0

CSS

๋ชฉ๋ก ๋ณด๊ธฐ
4/4

๐Ÿ”ธ Keyframe ์•Œ์•„๋ณด๊ธฐ

    <div class="box"></div>
    <ul class="progress">
        <li></li>
    </ul>
/* ๋ธŒ๋ผ์šฐ์ € ๊ตฌ๋ถ„ ์—†์ด ํ‘œ์ค€๋ฐฉ์‹์€ w3c์—์„œ ๊ถŒ๊ณ  */
@keyframes{}
/* ๋ฒค๋”ํ”„๋ฆฌํ”ฝ์Šค : ๋ธŒ๋ผ์šฐ์ € ์ œ์กฐ์‚ฌ๋ฅผ ๊ตฌ๋ถ„ํ•˜๋Š” ์ฝ”๋“œ๋กœ,
๋ธŒ๋ผ์šฐ์ €๋งˆ๋‹ค ์†์„ฑ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ์‹์ด ๋‹ฌ๋ผ ๊ฐ ๋ธŒ๋ผ์šฐ์ €์— ๋งž๋Š” ์†์„ฑ์„
๋ณ„๋„๋กœ ์ž‘์„ฑํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. */
/* Opera์‚ฌ์˜ Opera๋ธŒ๋ผ์šฐ์ € ๋Œ€๋ถ€๋ถ„ ๋ชจ๋ฐ”์ผ์ „์šฉ ๋ธŒ๋ผ์šฐ์ € */
@-o-keyframes{}
/* Micro Soft์‚ฌ์˜ IE */
@-ms-keyfrmes{}
/* Mozilla์‚ฌ์˜ Fire Fox */
@-moz-keyframes{}
/* webkit์—”์ง„ ๊ธฐ๋ฐ˜์œผ๋กœ ๋งŒ๋“ค์–ด์ง„ ๋ธŒ๋ผ์šฐ์ €, ํฌ๋กฌ, ์‚ฌํŒŒ๋ฆฌ, ์—ฃ์ง€ ๋“ฑ */
@-webkit-keyframes{}

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

.box{
    width: 200px; height: 200px;
    background-color: #f90;
    transition-property: width, background-color;
    transition-duration: 0.3s;
    /* ๊ตฌ์„ฑ๋œ ํ‚คํ”„๋ ˆ์ž„์˜ ์ด๋ฆ„ */
    /* animation-name: myAni; */
    /* ํ‚คํ”„๋ ˆ์ž„์ด ์ž‘๋™๋˜๋Š” ์‹œ๊ฐ„ */
    animation-duration: 3s;
    /* ํ‚คํ”„๋ ˆ์ž„์˜ ๋ฐ˜๋ณต ํšŸ์ˆ˜ */
    animation-iteration-count: infinite;
    /* animation: name duration timing-function delay iteration-count direction fill-mode; */
    animation-play-state: paused;

}
.box:hover{
    width: 400px;
}
.box:active{
    background-color: #f00;
}
.progress{
    padding: 0;
    margin: 0;
    list-style: none;
    width: 600px;
    background-color: #ccc;
} 
.progress li{
    width: 0%;
    height: 30px;
    background-color: #f60;
    border-radius: 20px;
    border: 4px solid #ccc;
    box-sizing: border-box;
    animation-name: myProg;
    animation-duration: 1s;
    animation-iteration-count: 1;
    animation-fill-mode: forwards;
    /* linear(์ผ์ •ํ•œ์†๋„) | ease-in(๊ฐ€์†) | ease-out(๊ฐ์†) |*/
    animation-timing-function: cubic-bezier(0,1.17,1,.39);
}
@keyframes myProg{
    0%{
        width: 0%;
    }
    100%{
        width: 90%;
    }
}

0๊ฐœ์˜ ๋Œ“๊ธ€