svg常见形状
SVG是使用XML来描述二维图形和绘图程序的语言。是指可伸缩矢量图形(Scalable Vector Graphics),svg、图像在放大或改变尺寸的情况下图形质量不会有所损失。
svg的主要竞争者是Flash(未开源的私有技术)
HTML中引入svg文件:<embed>、 <object>(不能使用脚本)、 <iframe>
<embed src=" " width=" " height=" " type="image/svg+xml">
svg形状
1、圆形
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
<!-- y、x圆形起点坐标(默认为(, )),r为圆半径,stoke边框色,stroke-width边框宽度,fill填充色 stroke-opacity边框透明度 fill-opacity填充色透明度-->
<circle cx="" cy="" r="" stroke="black" stroke-width="" fill="red" fill-opacity="" stroke-opacity=""/>
</svg>

2.矩形
<?xml version="1.0" standalone="no" ?>
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect width="" height="" style="fill: rgb(12,23,34);stroke:#0f0; stroke-width:2" />
</svg>
<?xml version="1.0" standalone="no" ?>
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
<!-- rx,ry产生圆角, opacity 属性定义整个元素的透明值 -->
<rect width="" height="" x="" y="" style="fill:blue; stroke:pink; stroke-width:5;stroke-opacity:.5; rx:20; ry:20"/>
</svg>


3.椭圆
<?xml version="1.0" standalone="no" ?>
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
<!-- cx,cx原点;rx,ry半径 -->
<ellipse width="200" height="100" cx="100" cy="50" rx="100" ry="50" style="fill: rgb(12,23,34);stroke:#0f0; stroke-width:2" />
</svg>

4.线
<?xml version="1.0" standalone="no" ?> <!-- xml声明,standalone规定svg是否为独立的文件 -->
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
<!-- x1,y1:线条开始位置,x2,y2:线条结束位置 -->
<line x1="0" y1="50" x2="300" y2="50" style="stroke:red; stroke-width:3"/>
</svg>
<?xml version="1.0" ?>
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
<polyline points="0 0, 20 20, 70 30, 40 40, 40 40, 60 60" style="fill:yellow; stroke:green; stroke-width:2" />
</svg>


5.多边形
<?xml version="1.0" standalone="no" ?> <!-- xml声明,standalone规定svg是否为独立的文件 -->
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
<!-- points定义多边形每个角的x,y坐标 -->
<polygon points="0 0, 100 0, 130 50, 100 100,0 50" style="stroke:red; stroke-width:3; fill: green"/>
</svg>

6.路径
<?xml version="1.0" ?>
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
<!--大写表示绝对位置,小写相对位置
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="M153 334
C153 334 151 334 151 334
C151 339 153 344 156 344
C164 344 171 339 171 334
C171 322 164 314 156 314
C142 314 131 322 131 334
C131 350 142 364 156 364
C175 364 191 350 191 334
C191 311 175 294 156 294
C131 294 111 311 111 334
C111 361 131 384 156 384
C186 384 211 361 211 334
C211 300 186 274 156 274
" style="fill:green;stroke:red;stroke-width:2"/>
</svg>

7.文字
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<!-- x,y起点位置 fill字体色 transform -->
<text x="0" y="15" fill="red">I love SVG</text>
<text x="0" y="50" fill="green" transform="rotate(30 20, 40)">I LOVE svg</text>
<text x="10" y="90" style="fill:red;">Several lines:
<tspan x="10" y="115">First line</tspan>
<tspan x="10" y="140">Second line</tspan>
</text>
</svg>

svg常见形状的更多相关文章
- SVG基本形状及样式设置
前面的话 图形分为位图和矢量图.位图是基于颜色的描述,是由像素点组成的图像:而矢量图是基于数学矢量的描述,是由几何图元组成的图像,与分辨率无关.可缩放矢量图形,即SVG,是W3C XML的分支语言之一 ...
- 数据可视化系列--svg入门基础(一)
一.前言 1.SVG(Scalable Vector Graphics)可伸缩矢量图形 特点: (1)使用xml格式来定义图形: (2)用来定义web上的使用的矢量图: (3)改变图像尺寸,图片质量不 ...
- 【Web动画】SVG 线条动画入门
通常我们说的 Web 动画,包含了三大类. CSS3 动画 javascript 动画(canvas) html 动画(SVG) 个人认为 3 种动画各有优劣,实际应用中根据掌握情况作出取舍,本文讨论 ...
- SVG 路径(path)
本文转自:https://developer.mozilla.org/zh-CN/docs/Web/SVG/Tutorial/Paths <path>元素是SVG基本形状中最强大的一个,它 ...
- 关于svg
动画:css3动画,canvas(js动画),svg(html动画). svg基本元素 version: 表示 <svg> 的版本,目前只有 1.0,1.1 两种 xmlns:http:/ ...
- SVG笔记
SVG可缩放矢量图形(Scalable Vector Graphics)是基于可扩展标记语言(XML),用于描述二维矢量图形的一种图形格式.SVG是W3C("World Wide Web C ...
- HTML5学习--SVG全攻略(基础篇)
明天高级篇 一.什么是SVG? SVG 指的是可伸缩矢量图形 (Scalable Vector Graphics),它用来定义用于网络的基于矢量的图形,使用 XML 格式定义图形.SVG 图像在放大或 ...
- p2 形状
形状是物理引擎进行碰撞模拟计算的依据,是刚体最基本的属性. P2中使用Shape类来表示形状,通过刚体的addShape()方法,将形状添加到刚体中之后, 就可以随着刚体的移动.旋转不断更新,并进行碰 ...
- svg矢量图制作工具(Sketsa SVG Editor) v7.1.1 中文免费版
下载地址:https://www.jb51.net/softs/555253.html Sketsa SVG Editor中文版是一款强大好用的矢量图绘制工具,该工具的最大特色就是集成了中文语言,且支 ...
随机推荐
- 运用python发邮件
1.网上有许多发送邮件的代码,运行了几次都不成功(使用python3),转用Python2之后,发送成功 2.代码样例: 参考教程:http://www.runoob.com/python/pytho ...
- sface
单步检测方法分为两类:anchor-based如ssd.RetinaNet;2)Anchor-free 如DenseBox.UnitBox;anchor-based处理的尺度范围虽小,更精准:anch ...
- mybatis-generator 代码自动生成工具包
怎么用mybatis-gennerator插件自动生成mybatis所需要的dao.bean.mapper xml文件.请看↓ 1.在D盘新建一个文件夹,命名:generator(或者其他盘其他名字也 ...
- css样式支持左右滑动要点
div 包含 ul ,ul 包含 li div宽度固定,ul 宽度随着li的可以无限增加,li 左右滑动的最小容器. div 样式position:relative;width:xxpx;height ...
- MIME 参考手册
本文摘自http://www.w3school.com.cn/media/media_mimeref.asp MIME (Multipurpose Internet Mail Extensions) ...
- ACE如何生成VS工程之mwc.pl用法
1.先写个mwc文件,文件名为hello.mwc workspace { hello.mpc} 2.写mpc文件,文件名为hello.mpc project(hello):aceexe, acexml ...
- commons-lang常用方法
跟java.lang这个包的作用类似,Commons Lang这一组API也是提供一些基础的.通用的操作和处理,如自动生成toString()的结果.自动实现hashCode()和equals()方法 ...
- 第二次靶场练习:cookie注入
cookie注入 本文章目的是对相关的黑客内容进一步了解,如有人违反相关的法律法规,本人概不负责 一.学习目的: 利用手工注入网站 利用sqlmab注入 二.附件说明 靶场网址:http://120. ...
- mysql 5.7安装图解 mysql 5.7图文安装完整教程
今天给搭建分享一个教程,mysql 5.7的安装操作,这里呢我叫大家怎么用二进制去安装mysql,其实在大多数的生产环境中使用二进制预编译的安装方式是最多了,下面大家跟着我的步骤去尝试着安装下吧. 先 ...
- The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
好久没有冒泡了,最近在新环境上搭建应用时,启动报错: INFO: Illegal access: this web application instance has been stopped alre ...