728x90
반응형
Text Wave
글자가 웨이브
HTML
HTML를 이용하여 진행
<h1>
<span>c</span>
<span>o</span>
<span>d</span>
<span>e</span>
<span>p</span>
<span>e</span>
<span>n</span>
</h1>
CSS
CSS를 이용하여 진행합니다. top을 20px를 주고, @keyframes으로 top을 -20px로 부여하여 움직임을 줍니다. nth-child로 각 글자마다 딜레이를 만들어줍니다.
html,body {
width: 100%;
height: 100%;
background: linear-gradient(140deg, skyblue 0%, plum 100%);
display: flex;
justify-content: center;
align-items: center;
}
h1 {
height: 100px;
}
h1 span {
font-family: '궁서체';
font-size: 80px;
color: #fff;
position: relative;
top: 20px;
display: inline-block;
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.2s;}
h1 span:nth-child(4){animation-delay: 0.3s;}
h1 span:nth-child(5){animation-delay: 0.4s;}
h1 span:nth-child(6){animation-delay: 0.5s;}
h1 span:nth-child(7){animation-delay: 0.6s;}
@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);
}
}
결과
See the Pen textWave by kimyihyung (@kimyihyung) on CodePen.
728x90
반응형
'CSS' 카테고리의 다른 글
loading Animation (2) | 2022.09.23 |
---|---|
growing box Animation (6) | 2022.09.22 |
Mouse Hover Effect Animation (3) | 2022.09.20 |
Wave Animation (5) | 2022.09.19 |
CSS - animation (7) | 2022.09.08 |