以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 SVG/GML/VRML/X3D/XAML 』  (http://bbs.xml.org.cn/list.asp?boardid=21)
----  [求助]请问怎么实现左上至右下的渐变?(用linearGradient)  (http://bbs.xml.org.cn/dispbbs.asp?boardid=21&rootid=&id=59070)


--  作者:19774279
--  发布时间:2/22/2008 3:23:00 PM

--  [求助]请问怎么实现左上至右下的渐变?(用linearGradient)
下面是一本书上提供的源码,说实现了一个矩形中左上到右下的颜色渐变,可我自己试并不是这样的,出现的结果是从左至右渐变。书是2001年的,可能部分标准已经变了吧,望指点,谢谢。
附:浏览器:IE6+Adobe SVG Viewer、Opera9.24

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
      "http://www.w3.org/TR/2001/PR-SVG-20010719/
       DTD/svg10.dtd">
<svg width="500" height="300">
<defs>
  <linearGradient id="MyDiagonalGradient" x1="50"
      y1="50" x2="400" y2="200"
      gradientUnits="userSpaceOnUse">
    <stop offset="20%" style="stop-color:red"/>
    <stop offset="80%" style="stop-color:yellow"/>
  </linearGradient>
</defs>
<!-- Outline the drawing area in red. -->

<rect x="50" y="50" width="300" height="100"
  style="fill:url(#MyDiagonalGradient); stroke:none"/>
</svg>


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
46.875ms