SVG

2019-01-08  本文已影响0人  ft207741

Menu

SVG 实例

SVG 形状


SVG 实例

<?xml version="1.0" standalone="no"?>

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg width="100%" height="100%" version="1.1"
xmlns="http://www.w3.org/2000/svg">

<circle cx="100" cy="50" r="40" stroke="black"    
stroke-width="2" fill="red"/>

</svg>

<body>
    <svg version="1.1" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" >
        <circle onclick="doCircle(evt)" cx="100" cy="100" r="50" stroke="black" fill="red" stroke-width="2" />
    </svg>
    <script>
        // 圆形点击放大 再点击还原
        function doCircle(evt)
        {
            var theCircle = evt.target;
            var radius = theCircle.getAttribute("r");
            if (radius == 50)
            {
                radius = 75;
            }
            else
            {
                radius = 50;
            }
            theCircle.setAttribute("r",radius);
        }
    </script>
</body>
<object type="image/svg+xml" data="SVG.svg" style="display:block;width:1000px;height:1000px" >
    <param name="src" value="SVG.svg" >
</object>

SVG 形状


    <rect x="20" y="20" width="300" height="100"
    style="fill:blue;
          stroke-width:5;
          stroke:pink;
          opacity:0.9;
          fill-opacity:0.2;
          stroke-opacity:0.7" />

<circle cx="100" cy="50" r="40" stroke="black"
stroke-width="2" fill="red"/>

<ellipse cx="300" cy="150" rx="200" ry="80"
style="fill:rgb(200,100,50);
stroke:rgb(0,0,100);stroke-width:2"/>

<line x1="0" y1="0" x2="300" y2="300"
style="stroke:rgb(99,99,99);stroke-width:2"/>

<polygon points="220,100 300,210 170,250"
style="fill:#cccccc;
stroke:#000000;stroke-width:1"/>

<polyline points="0,0 0,20 20,20 20,40 40,40 40,60"
style="fill:white;stroke:red;stroke-width:2"/>




上一篇下一篇

猜你喜欢

热点阅读