zoukankan      html  css  js  c++  java
  • Notes:SVG(2)---各种常见图形

    1.矩形rect,指定rx,ry可以得到圆角矩形

    <rect x="10" y="10" rx="10" ry="10" width="150" height="150" style="fill:url(#orange_red)"/>
            <defs>
                <linearGradient id="orange_red" x1="0%" y1="0%" x2="100%" y2="0%">
                    <stop offset="20%" style="stop-color:rgb(255,255,0);
                    stop-opacity:1"/>
                    <stop offset="80%" style="stop-color:rgb(255,0,0);
                    stop-opacity:1"/>
                </linearGradient>
            </defs>

    2.圆形circle,cx,cy指定圆心,r指定半径

    <rect x="10" y="10" rx="10" ry="10" width="150" height="150" style="fill:url(#orange_red)"/>

    3.椭圆ellipse,cx,cy指定圆心,rx指定X轴半径,ry指定y轴半径

    <ellipse cx="100" cy="100" rx="100" ry="50" style="fill:url(#orange_red)" />

    4.线,指定两个点即可,(x1,y1)->(x2,y2)

    <line x1="10" y1="10" x2="100" y2="200" style="stroke:url(#orange_red);stroke-3" />

    5.折线polyline,指定多个点points每组坐标空格分开,连成一条线

    <polyline points="0,0 0,20 20,20 20,40 40,40 40,60" style="fill:#fff;stroke:url(#orange_red);stroke-1">

    6.多边形polygon

    <polygon points="20,20 60,20 80,40 60,60 20,60 0,40" style="fill:#fff;stroke:red;stroke-2"/>

    7.path路径,类似canvas里面的路径:

    下面的命令可用于路径数据:

    • M = moveto
    • L = lineto
    • H = horizontal lineto
    • V = vertical lineto
    • C = curveto
    • S = smooth curveto
    • Q = quadratic Belzier curve
    • T = smooth quadratic Belzier curveto
    • A = elliptical Arc
    • Z = closepath
    <path d="M250 150 L150 350 L350 350 Z" style="fill:red;stroke:red;"/>

    效果如下:

  • 相关阅读:
    计算机的时空观以及俩者间的相互转换
    发送一个记录数据包
    流的压缩与解压缩函数
    通过自定义消息调用主窗体的菜单项
    多标签窗体的释放一法
    记录数组存出到文件和从文件导入
    变体记录
    内存流的使用
    用流读写结构化文件
    下拉框、下拉控件之Select2
  • 原文地址:https://www.cnblogs.com/zmxmumu/p/6055237.html
Copyright © 2011-2022 走看看