SVG XML 格式定义图形入门介绍

SVG

SVG means Scalable Vector Graphics.

  • SVG 使用 XML 格式定义图形
  • SVG 图像在放大或改变尺寸的情况下其图形质量不会有所损失
  • SVG 是万维网联盟的标准

Hello World

  • Use SVG in html

and you can see:

  • Link to the SVG file You can use <a> tag to link to the svg file, like this:
<a href="rect.svg">rect.svg</a>

rect.svg

Shape

There some pre-shapes:

  • 矩形 <rect>
  • 圆形 <circle>
  • 椭圆 <ellipse>
  • 线 <line>
  • 折线 <polyline>
  • 多边形 <polygon>
  • 路径 <path>

Rect

Line

Polygon

the fill-rule

Polyline

Path

Some Commands

所有命令均允许小写字母。大写表示绝对定位,小写表示相对定位

M = moveto
L = lineto
H = horizontal lineto
V = vertical lineto
C = curveto
S = smooth curveto
Q = quadratic Bézier curve
T = smooth quadratic Bézier curveto
A = elliptical Arc
Z = closepath

Text

text zh_CN

  • Common text
Hello SVG Hello SVG

rotate(<rotate-angle> [<cx> <cy>])

Hello SVG Hello SVG
  • Text with path
I love SVG I love SVG

I love SVG I love SVG

  • <tspan>

元素可以安排任何分小组与<tspan>元素的数量

Several lines: First line Second line Several lines: First line Second line

Stroke

  • Stroke 属性定义一条线,文本或元素轮廓颜色

g元素这样的将多个元素组织在一起的元素

  • stroke-width 属性定义了一条线,文本或元素轮廓厚度
  • stroke-linecap 属性定义不同类型的开放路径的终结
  • stroke-dasharray 创建不同的虚线

相关推荐

  1. SVG XML 格式定义图形入门介绍

    2024-03-31 10:02:05       46 阅读
  2. pe格式入门图形化显示(五)-RVA和FOA

    2024-03-31 10:02:05       36 阅读
  3. pe格式入门图形化显示(四)-节表

    2024-03-31 10:02:05       37 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-31 10:02:05       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-31 10:02:05       100 阅读
  3. 在Django里面运行非项目文件

    2024-03-31 10:02:05       82 阅读
  4. Python语言-面向对象

    2024-03-31 10:02:05       91 阅读

热门阅读

  1. Kotlin语言教程

    2024-03-31 10:02:05       35 阅读
  2. FastAPI+React全栈开发16 设置一个React工作流

    2024-03-31 10:02:05       41 阅读
  3. Ecology9 分部(单位)获取示例

    2024-03-31 10:02:05       40 阅读
  4. I/O密集型任务和CPU密集型任务的理解与对比

    2024-03-31 10:02:05       36 阅读
  5. 给网站添加安全措施 -- http -> https

    2024-03-31 10:02:05       40 阅读
  6. vue 透传 Attributes

    2024-03-31 10:02:05       36 阅读
  7. 40个学习网站合集

    2024-03-31 10:02:05       34 阅读
  8. MySql的下载与安装

    2024-03-31 10:02:05       41 阅读
  9. Zookeeper设计的思想

    2024-03-31 10:02:05       41 阅读
  10. pg_rman在恢复服务器上恢复源库的备份

    2024-03-31 10:02:05       31 阅读
  11. js的Number对象和全局对象

    2024-03-31 10:02:05       35 阅读
  12. Spark SQL 数据源

    2024-03-31 10:02:05       41 阅读