当前位置:网站首页>Simple understanding of SVG
Simple understanding of SVG
2022-07-03 02:21:00 【Uncle ship】
svg
canvas and svg difference
canvas:
- Canvas yes H5 New label , It's the canvas . utilize JavaScript Draw an image on a web page .Canvas It's rendered pixel by pixel , Rich in color , Scaling distortion .
- Modify the graphics You need to redraw the entire canvas
svg:
- Scalable vector graphics ( Image format that will not be distorted after zooming Scalable Vector Graphics)
- svg It's through DOM Operation to display ,svg Each graph in is a separate node , Easy to change style .
svg
version:svg The version number of the specification followed 1.0 1.1 Two versions
xmlns: Definition svg Naming specification .
x y Represents the starting coordinate width and height Represents the width and height of the rectangle Before setting the fill color The default is black fill Set fill color
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect x="30" y="30" width="100" height="100" fill="pink" class="r"/>
</svg>
svg route
M:moveTo Move to a coordinate point
L:lineTo: Draw a line to a coordinate point
Z:close closed
stork: Line color
stork-width: The width of the line
<path d="M75,20 L100,100,L400,150,Z" fill="pink" stroke="yellow" stroke-width="10"> </path>
// Capitalization is absolute positioning Lowercase is relative positioning Relative to the previous coordinate
<path d="M75,20 l50,0,L50,10 Z" fill="" stroke="green" stroke-width=""> </path>
round
cx and cy It defines the center of a circle x y coordinate r For radius
<circle cx="100" cy="50" r="40" fill="" stroke="green" stroke-width="10">
The parameters respectively represent the starting coordinates Maximum radius and minimum radius Rotation Angle Large and small angle arc (1,0) Clockwise and counterclockwise (1,0) Coordinates of the end x y
<path d="M120,120 A60 60 0 1 1 121 121 Z" fill="" stroke="pink" stroke-width="20"> </path>
svg The gradient
id Is the only name of the gradient x1 y1 x2 y2 Set the direction of the gradient
<defs>
<linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="yellow" stop-opacity=""/>
<stop offset="33%" stop-color="blue" stop-opacity=""/>
<stop offset="66%" stop-color="green" stop-opacity=""/>
<stop offset="100%" stop-color="pink" stop-opacity=""/>
</linearGradient>
</defs>
// fill Set fill color id Is the name of the gradient
<rect x="10" y="10" width="200" height="200" fill="url(#grad)" style=""/>
svg Animation
svg Animation cannot be used due to some scenes , Simply understand .
Follow css Animation is very similar
attriName: deformation
type: Choose the animation operation mode Here is the rotation
form: Where to start
to: Where to end
dur: Animation execution time
repeatCount: Number of animation repetitions
<g>
<text x="150" y="100" style=""> having dinner sleep </text>
<animateTransform attributeName="transform"
attributeType="XML"
type="rotate"
from="0"
to="100"
dur="250ms"
repeatCount="indefinite"/>
</g>
svg written words
Define a route path id As the name of the text execution route according to id Select which alignment style the text is based on
<defs>
<path d="M0 50 l100 100 l100 -100 Z " id="p1"/>
<path d="M0 50 l100 100 l100 -100 Z " id="p2"/>
</defs>
<text x="" y="" style="">
<textPath xlink:href="#p1">
Tao Dahua Panglin What a lovely person, a group of old six
</textPath>
</text>
边栏推荐
- GBase 8c系统表-pg_authid
- Awk from getting started to getting into the ground (3) the built-in functions printf and print of awk realize formatted printing
- GBase 8c 函数/存储过程定义
- [Yu Yue education] reference materials of love psychology of China University of mining and technology
- Return a tree structure data
- QT qcombobox add qccheckbox (drop-down list box insert check box, including source code + comments)
- Apple releases MacOS 11.6.4 update: mainly security fixes
- Thread safe singleton mode
- Gbase 8C system table PG_ conversion
- Qt之QComboBox添加QCheckBox(下拉列表框插入复选框,含源码+注释)
猜你喜欢
Restcloud ETL cross database data aggregation operation
微信小程序開發工具 POST net::ERR_PROXY_CONNECTION_FAILED 代理問題
Use go language to realize try{}catch{}finally
stm32F407-------IIC通讯协议
Y54. Chapter III kubernetes from introduction to mastery -- ingress (27)
The data in servlet is transferred to JSP page, and the problem cannot be displayed using El expression ${}
创建+注册 子应用_定义路由,全局路由与子路由
Depth (penetration) selector:: v-deep/deep/ and > > >
Wechat applet development tool post net:: err_ PROXY_ CONNECTION_ Failed agent problem
详细些介绍如何通过MQTT协议和华为云物联网进行通信
随机推荐
COM and cn
Gbase 8C system table PG_ database
【CodeForces】CF1338A - Powered Addition【二进制】
The use of Flink CDC mongodb and the implementation of Flink SQL parsing complex nested JSON data in monggo
[Yu Yue education] China Ocean University job search OMG reference
微信小程序開發工具 POST net::ERR_PROXY_CONNECTION_FAILED 代理問題
Awk from getting started to getting into the ground (3) the built-in functions printf and print of awk realize formatted printing
詳細些介紹如何通過MQTT協議和華為雲物聯網進行通信
GBase 8c系统表-pg_am
Leetcode 183 Customers who never order (2022.07.02)
require. context
Tongda OA V12 process center
Su Shimin: 25 principles of work and life
Socket编程
Missing library while loading shared libraries: libisl so. 15: cannot open shared object file: No such file
COM和CN
Current situation and future of Web3 in various countries
awk从入门到入土(1)awk初次会面
Explore the conversion between PX pixels and Pt pounds, mm and MM
机器学习流程与方法