λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°
CSS/Animation

ν…μŠ€νŠΈ 효과 μ• λ‹ˆλ©”μ΄μ…˜

by oranssy 2022. 9. 8.
728x90
λ°˜μ‘ν˜•

⭐️ μ• λ‹ˆλ©”μ΄μ…˜ 효과 : ν…μŠ€νŠΈ 효과 ⭐️


01. μ• λ‹ˆλ©”μ΄μ…˜ 효과

μ• λ‹ˆλ©”μ΄μ…˜(Animation) νš¨κ³ΌλŠ” HTML μš”μ†Œμ— μ μš©λ˜λŠ” CSS μŠ€νƒ€μΌμ„ λ‹€λ₯Έ CSS μŠ€νƒ€μΌλ‘œ λΆ€λ“œλŸ½κ²Œ λ³€ν™”μ‹œν‚΅λ‹ˆλ‹€.
μ• λ‹ˆλ©”μ΄μ…˜μ€ μ• λ‹ˆλ©”μ΄μ…˜μ„ λ‚˜νƒ€λ‚΄λŠ” CSS μŠ€νƒ€μΌκ³Ό μ• λ‹ˆλ©”μ΄μ…˜μ˜ μ—°μ†λœ μž₯λ©΄(sequence)λ₯Ό λ‚˜νƒ€λ‚΄λŠ” 볡수의 ν‚€ν”„λ ˆμž„(@keyframes)λ“€λ‘œ μ΄λ£¨μ–΄μ§‘λ‹ˆλ‹€.

   ___ μ°Έκ³ ν•˜κΈ° ___
  `1   @keyframes : CSS μ• λ‹ˆλ©”μ΄μ…˜μ—μ„œ ꡬ간을 μ •ν•˜κ³  각 κ΅¬κ°„λ³„λ‘œ μ–΄λ–€ μŠ€νƒ€μΌμ„ μ μš©μ‹œν‚¬μ§€ μ •ν•©λ‹ˆλ‹€.


02. λˆˆμ— λ„λŠ” ν…μŠ€νŠΈ 효과 λ§Œλ“€κΈ°

[1] < div > λ°•μŠ€ λ§Œλ“€κΈ°

svg νƒœκ·Έλ₯Ό λ§Œλ“€μ–΄ μ€λ‹ˆλ‹€.

  <svg viewBox="0 0 1320 300">
  <text x="50%" y="50%" dy="40px" text-anchor="middle">oranssy</text>
</svg>

[2] CSS μ„€μ •ν•˜κΈ°

@keyframes 을 μ΄μš©ν•˜μ—¬ μ• λ‹ˆλ©”μ΄μ…˜μ˜ μ›€μ§μž„μ„ μ‘°μ ˆν•©λ‹ˆλ‹€.

  @font-face {
    font-family: 'VitroCore';
    font-weight: normal;
    font-style: normal;
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/vitro/VitroCore.eot');
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/vitro/VitroCore.eot?#iefix') format('embedded-opentype'),
        url('https://cdn.jsdelivr.net/gh/webfontworld/vitro/VitroCore.woff2') format('woff2'),
        url('https://cdn.jsdelivr.net/gh/webfontworld/vitro/VitroCore.woff') format('woff'),
        url('https://cdn.jsdelivr.net/gh/webfontworld/vitro/VitroCore.ttf') format("truetype");
    font-display: swap;
}
body  {
  background-color: #FFFFE0;
}
svg {
  font-family: 'VitroCore';
	font-size: 140px;
	position: absolute;
	width: 100%;
	height: 100%;
	text-transform: uppercase;
	animation: stroke 5s 1 alternate;
	fill: rgba(72,138,204,1);
}
@keyframes stroke {
	0%   {
		stroke-dashoffset: 25%;
		stroke-dasharray: 0 50%;
		fill: rgba(72,138,204,0);
		stroke: rgba(54,95,160,1);
		stroke-width: 2;
	}
	70%  {
		fill: rgba(72,138,204,0);
		stroke: rgba(54,95,160,1);
	}
	80%  {
		fill: rgba(72,138,204,0);
		stroke: rgba(54,95,160,1);
	}
	100% {
		stroke-dashoffset: -25%;
		stroke-dasharray: 50% 0;
		fill: rgba(72,138,204,1);
		stroke: rgba(54,95,160,0);
		stroke-width: 0;
	}
}

결과보기

728x90
λ°˜μ‘ν˜•

'CSS > Animation' μΉ΄ν…Œκ³ λ¦¬μ˜ λ‹€λ₯Έ κΈ€

κ±Έμ–΄κ°€μž  (3) 2022.09.08
CSS animation  (3) 2022.09.08
SVG animation  (5) 2022.09.08
μ• λ‹ˆλ©”μ΄μ…˜ 효과 _ λ¬΄ν•œλŒ€ 곡  (5) 2022.09.05
μ• λ‹ˆλ©”μ΄μ…˜ λΉ™κΈ€λΉ™κΈ€  (5) 2022.08.29

λŒ“κΈ€