cy
cy 屿§å®ä¹ä¸ä¸ªä¸å¿ç¹ç y è½´åæ ã
æä¸ä¸ªå
ç´ å¨ä½¿ç¨æ¤å±æ§ï¼<circle>ï¼<ellipse> å <radialGradient>
示ä¾
html
<svg viewBox="0 0 100 300" xmlns="http://www.w3.org/2000/svg">
<radialGradient cy="25%" id="myGradient">
<stop offset="0" stop-color="white" />
<stop offset="100%" stop-color="black" />
</radialGradient>
<circle cy="50" cx="50" r="45" />
<ellipse cy="150" cx="50" rx="45" ry="25" />
<rect x="5" y="205" width="90" height="90" fill="url(#myGradient)" />
</svg>
å
å¯¹äº <circle>ï¼cy ç¨æ¥å®ä¹å¾å½¢ä¸å¿ç y è½´åæ ã
| å¼ | <length-percentage> |
|---|---|
| é»è®¤å¼ | 0 |
| å¯åæ§ | Yes |
**注ï¼**èµ·å§äº SVG2ï¼cy æ¯ä¸ä¸ªå ä½å±æ§ï¼æå³çè¯¥å±æ§ä¹å¯ä»¥ç¨ä½åç CSS 屿§ã
æ¤å
å¯¹äº <ellipse>ï¼cy ç¨æ¥å®ä¹å¾å½¢ä¸å¿ç y è½´åæ ã
| å¼ | <length-percentage> |
|---|---|
| é»è®¤å¼ | 0 |
| å¯åæ§ | Yes |
**注ï¼**èµ·å§äº SVG2ï¼cy æ¯ä¸ä¸ªå ä½å±æ§ï¼æå³çè¯¥å±æ§ä¹å¯ä»¥ç¨ä½æ¤åç CSS 屿§ã
å¾åæ¸å
å¯¹äº <radialGradient>ï¼cy ç¨æ¥å®ä¹å¾åæ¸åç»æ¢åç y è½´åæ ã
| å¼ | <length-percentage> |
|---|---|
| é»è®¤å¼ | 50% |
| å¯åæ§ | Yes |
示ä¾
html
<svg viewBox="0 0 34 10" xmlns="http://www.w3.org/2000/svg">
<defs>
<radialGradient cy="0" id="myGradient000">
<stop offset="0%" stop-color="gold" />
<stop offset="50%" stop-color="green" />
<stop offset="100%" stop-color="white" />
</radialGradient>
<radialGradient cy="50%" id="myGradient050">
<stop offset="0%" stop-color="gold" />
<stop offset="50%" stop-color="green" />
<stop offset="100%" stop-color="white" />
</radialGradient>
<radialGradient cy="100%" id="myGradient100">
<stop offset="0%" stop-color="gold" />
<stop offset="50%" stop-color="green" />
<stop offset="100%" stop-color="white" />
</radialGradient>
</defs>
<rect
x="1"
y="1"
width="8"
height="8"
fill="url(#myGradient000)"
stroke="black" />
<rect
x="13"
y="1"
width="8"
height="8"
fill="url(#myGradient050)"
stroke="black" />
<rect
x="25"
y="1"
width="8"
height="8"
fill="url(#myGradient100)"
stroke="black" />
</svg>
è§è
| Specification |
|---|
| Scalable Vector Graphics (SVG) 2 > # RadialGradientElementCYAttribute > |