반응형
250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- scrollY
- classList
- html
- swiper
- mousemove
- addEventListener
- React
- 확장성
- localstorage
- Animation
- width
- swiperjs
- scrollevent
- getBoundingClientRect
- For
- NAV
- 스크롤
- insertAdjacentHTML
- scroll
- pointermove
- Hover
- input
- 애니메이션
- css
- 반복문
- forEach
- Sticky
- 이벤트리스너
- JavaScript
- NodeList
Archives
- Today
- Total
ZeroToHunnit Coding
[CSS] 가변 폰트와 font-variation-settings 본문
728x90
반응형
이런 신기한 폰트 애니메이션을 만들어보았다.
HTML
<p class="font">H</p>
<p class="font">E</p>
<p class="font">L</p>
<p class="font">L</p>
<p class="font">O</p>
<p class="font">W</p>
<p class="font">O</p>
<p class="font">R</p>
<p class="font">L</p>
<p class="font">D</p>
p태그에 따로따로 담아주었다.
CSS
.font{
font-family: "Hepta Slab";
text-align: center;
margin-top: 300px;
font-size: 60px;
font-variation-settings: "wght"100;
white-space: nowrap;
float: left;
animation: ani infinite cubic-bezier(0.215, 0.610, 0.355, 1) 2s;
}
.font:nth-child(2){
animation-delay: 0.1s;
}
.font:nth-child(3){
animation-delay: 0.2s;
}
.font:nth-child(4){
animation-delay: 0.3s;
}
.font:nth-child(5){
animation-delay: 0.4s;
}
.font:nth-child(6){
animation-delay: 0.5s;
}
.font:nth-child(7){
animation-delay: 0.6s;
}
.font:nth-child(8){
animation-delay: 0.7s;
}
.font:nth-child(9){
animation-delay: 0.8s;
}
.font:nth-child(10){
animation-delay: 0.9s;
}
@keyframes ani{
0%{
font-variation-settings: "wght"100;
}
50%{
font-variation-settings: "wght"900;
}
100%{
font-variation-settings: "wght"100;
}
}
가변 폰트를 import해주고 import한 폰트를 적용해 font-variation-settings를 이용한 애니메이션을 만들어보았다.
먼저 가변 폰트란? 쉽게 설명해서 font 찾다보면 variation이라고 적힌 폰트들이 같이 붙어있다. 그게 가변폰트이다.
이 가변폰트를 이용할 수 있는 css코드가 font-variation-settings다. "wght"를 100~900으로 조절해서 저렇게 폰트가 혼자 커졌다 작아졌다하는 애니메이션을 만들어서 각 글자에 animation-delay를 조절해서 파도타기처럼 만들었다.
이것은 흥미로운 폰트 애니메이션 예제다! 가변 폰트와 font-variation-settings를 활용하여 글자의 두께를 조절하여 애니메이션 효과를 만들어내는 것은 창의적이고 독특한 방법이다.
실용성이 상대적으로 낮을 수 있지만, 이러한 실험적인 디자인은 창의성을 발전시키고 새로운 아이디어를 찾을 수 있는 좋은 방법일 수 있다. 또한, 이러한 효과를 조합하여 더 복잡하고 흥미로운 애니메이션을 만들 수도 있다.
웹 디자인 및 개발에서 실험을 통해 새로운 기술과 아이디어를 탐색하는 것은 항상 좋은 일이다. 실제로는 사용되지 않더라도 학습과 창의성에 큰 도움이 될 수 있다.
공유해주셔서 감사합니다!
728x90
반응형
'HTML,CSS' 카테고리의 다른 글
[CSS] 텍스트 호버(hover) 애니메이션 (0) | 2024.01.08 |
---|---|
[CSS] 배경 색상마다 글자색을 다르게 해주는 mix-blend-mode (0) | 2024.01.07 |
[HTML] 시맨틱 마크업 태그 정리 (0) | 2023.12.30 |
[HTML,CSS] 글자 색 채우기 애니메이션 (2) | 2023.12.22 |
[CSS] Position:sticky (0) | 2023.12.19 |