ss [CSS]애니메이션05
본문 바로가기
CSS

[CSS]애니메이션05

by 꿈나무개발 2022. 9. 21.
728x90

애니메이션05

오늘은 아래와 같이 글씨가 통통 튀는 애니메이션을 만들어 보았습니다.

HTML

<h1>
    <span>a</span>
    <span>b</span>
    <span>c</span>
    <span>d</span>
    <span>e</span>
    <span>f</span>
    <span>g</span>
    <span>h</span>
    <span>i</span>
</h1>     

CSS

@font-face {
    font-family: 'CrownMychew';
    font-weight: normal;
    font-style: normal;
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/crown/CrownMychew.eot');
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/crown/CrownMychew.eot?#iefix') format('embedded-opentype'),
            url('https://cdn.jsdelivr.net/gh/webfontworld/crown/CrownMychew.woff2') format('woff2'),
            url('https://cdn.jsdelivr.net/gh/webfontworld/crown/CrownMychew.woff') format('woff'),
            url('https://cdn.jsdelivr.net/gh/webfontworld/crown/CrownMychew.ttf') format("truetype");
    font-display: swap;
}
html,body{
    width: 100%;
    height: 100%;
    background: linear-gradient(140deg, #544a7d 0%, #ffd452 100%);
    display: flex;
    justify-content: center;
    align-items: center;  
}

h1 {
    height: 100px;
}
h1 span {
    font-family: 'CrownMychew';
    font-size: 80px;
    color: #fff;
    position: relative;
    top: 20px;
    display: inline-block;
    -webkit-font-smoothing: antialiased;
    text-shadow: 0 1px 0 #ccc,
                0 2px 0 #ccc,
                0 3px 0 #ccc,
                0 4px 0 #ccc,
                0 5px 0 #ccc,
                0 6px 0 transparent,
                0 7px 0 transparent,
                0 8px 0 transparent,
                0 9px 0 transparent,
                0 10px 10px rgba(0,0,0,0.4);
    animation: bounce 0.3s ease infinite alternate;
}

h1 span:nth-child(2) {animation-delay:0.1s;}
h1 span:nth-child(3) {animation-delay:0.3s;}
h1 span:nth-child(4) {animation-delay:0.5s;}
h1 span:nth-child(5) {animation-delay:0.7s;}
h1 span:nth-child(6) {animation-delay:0.9s;}
h1 span:nth-child(7) {animation-delay:1.1s;}
h1 span:nth-child(8) {animation-delay:1.3s;}
h1 span:nth-child(9) {animation-delay:1.5s;}

@keyframes bounce {
    100% {
    top: -20px;
    text-shadow: 0 1px 0 #ccc,
                0 2px 0 #ccc,
                0 3px 0 #ccc,
                0 4px 0 #ccc,
                0 5px 0 #ccc,
                0 6px 0 transparent,
                0 7px 0 transparent,
                0 8px 0 transparent,
                0 9px 0 transparent,
                0 50px 25px rgba(0,0,0,0.4);
    }
}
728x90
반응형

'CSS' 카테고리의 다른 글

[CSS]애니메이션07  (1) 2022.09.25
[CSS]애니메이션06  (3) 2022.09.22
[CSS]MouseHoverEffect01  (3) 2022.09.20
[CSS]애니메이션04  (3) 2022.09.19
[CSS]CSS intro  (5) 2022.09.07

댓글


HTML
CSS
JAVASCRIPT

JAVASCRIPT

자세히보기
광고 준비중입니다.