SVG(Scalable Vector Graphics)λ₯Ό μ‚¬μš©ν•˜μ—¬ κ·ΈλΌλ°μ΄μ…˜(Gradient)을 μ μš©ν•˜λŠ” λͺ‡ κ°€μ§€ μ˜ˆμ‹œλ₯Ό μ•„λž˜μ— μ œμ‹œν•˜κ² μŠ΅λ‹ˆλ‹€. κ·ΈλΌλ°μ΄μ…˜μ€ μƒ‰μƒμ˜ λΆ€λ“œλŸ¬μš΄ μ „ν™˜μ„ μƒμ„±ν•˜λŠ” 데 μ‚¬μš©λ˜λ©°, μ„ , λ„ν˜•, ν…μŠ€νŠΈ λ“± μ—¬λŸ¬ μš”μ†Œμ— μ μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

  1. μ„ ν˜• κ·ΈλΌλ°μ΄μ…˜ (Linear Gradient): μ„ ν˜• κ·ΈλΌλ°μ΄μ…˜μ€ 두 점을 μ—°κ²°ν•˜λŠ” μ„  μƒμ—μ„œ 색상이 λΆ€λ“œλŸ½κ²Œ λ³€ν•˜λŠ” 효과λ₯Ό μ€λ‹ˆλ‹€.
xml
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <linearGradient id="linearGradient" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" style="stop-color:rgb(255,0,0);stop-opacity:1" /> <stop offset="100%" style="stop-color:rgb(0,0,255);stop-opacity:1" /> </linearGradient> </defs> <rect width="200" height="200" fill="url(#linearGradient)" /> </svg>
  1. μ›ν˜• κ·ΈλΌλ°μ΄μ…˜ (Radial Gradient): μ›ν˜• κ·ΈλΌλ°μ΄μ…˜μ€ μ€‘μ‹¬μ—μ„œ μ™ΈλΆ€λ‘œ 색상이 λΆ€λ“œλŸ½κ²Œ λ³€ν•˜λŠ” 효과λ₯Ό μ€λ‹ˆλ‹€.
xml
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <radialGradient id="radialGradient" cx="50%" cy="50%" r="50%" fx="50%" fy="50%"> <stop offset="0%" style="stop-color:rgb(255,0,0);stop-opacity:1" /> <stop offset="100%" style="stop-color:rgb(0,0,255);stop-opacity:1" /> </radialGradient> </defs> <circle cx="100" cy="100" r="100" fill="url(#radialGradient)" /> </svg>
  1. 반볡 κ·ΈλΌλ°μ΄μ…˜ (Repeating Gradient): κ·ΈλΌλ°μ΄μ…˜μ„ λ°˜λ³΅ν•˜μ—¬ μ μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
xml
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <linearGradient id="repeatingGradient" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" style="stop-color:rgb(255,0,0);stop-opacity:1" /> <stop offset="50%" style="stop-color:rgb(0,255,0);stop-opacity:1" /> <stop offset="100%" style="stop-color:rgb(0,0,255);stop-opacity:1" /> </linearGradient> </defs> <rect width="200" height="200" fill="url(#repeatingGradient)" /> </svg>

μ΄λŸ¬ν•œ μ˜ˆμ‹œλ“€μ€ κ°„λ‹¨ν•œ SVG μ½”λ“œλ‘œ κ·ΈλΌλ°μ΄μ…˜μ„ μ‚¬μš©ν•˜λŠ” 방법을 λ³΄μ—¬μ€λ‹ˆλ‹€. μ„ ν˜• κ·ΈλΌλ°μ΄μ…˜, μ›ν˜• κ·ΈλΌλ°μ΄μ…˜, 그리고 반볡 κ·ΈλΌλ°μ΄μ…˜μ„ μ‘°ν•©ν•˜μ—¬ 더 λ‹€μ–‘ν•œ 효과λ₯Ό λ§Œλ“€ 수 μžˆμŠ΅λ‹ˆλ‹€. SVG μ½”λ“œλ₯Ό 톡해 색상, μœ„μΉ˜, 크기 등을 μ‘°μ ˆν•˜μ—¬ μ›ν•˜λŠ” κ·ΈλΌλ°μ΄μ…˜ 효과λ₯Ό 얻을 수 μžˆμŠ΅λ‹ˆλ‹€.