当前位置:网站首页>svg和canvas的区别
svg和canvas的区别
2022-06-30 04:46:00 【前端同学】
svg定义
1.可伸缩的矢量图形
2.是基于xml进行绘制图形
3.svg放大或者改变尺寸情况下图形质量不会有损。
4.svg 绘制出来的每⼀个图形的元素都是独⽴的 DOM 节点,
canvas定义
1.h5新增属性
2.基于js进行绘制图形
两者区别
1、svg每个图形都可以看作是一个对象,如果对象属性发生变化,浏览器可自动重现图形。根据变化自动改变变化部分即可。canvas图形如果绘制完成,不会再得到浏览器的关注。如果图形位置改变,浏览器需要重新绘制。
2、canvas依赖分辨率,svg不依赖分辨率。
3、canvas不支持事件处理器,svg支持。Canvas 绘制的图像 都在Canvas这个画布里面,是Canvas的一部分,不能用js获取已经绘制好的图形元素。
SVG 的一个图形对应一个元素,所以我们可以像处理 DOM 元素一样,很容易地给 SVG 图形元素添加对应的鼠标事件,这也是SVG相较于Canvas的一个非常大的优点可以让图形的用户交互非常简单。
4、canvas适用于大型渲染区域区域程序(比如谷歌地图),svg适用于图像密集型游戏。
边栏推荐
- Unity realizes rotation and Revolution
- Deeply understand the function calling process of C language
- Interprocess communication
- 【Paper】2021_ Observer-Based Controllers for Incrementally Quadratic Nonlinear Systems With Disturbanc
- 破局存量客群营销,试一下客户分群管理(含聚类模型等实操效果评估)
- Easyrecovery data recovery software recovers my photo and video data two years ago
- One interview question and one joint index every day
- [fpga] implementation of IIC read / write EEPROM
- PBR material: basic principle and simple fabrication
- Introduction to some representations, neighbors and degrees of Graphs
猜你喜欢

Software digital signature certificate

Easyrecovery data recovery software recovers my photo and video data two years ago

Redis implements SMS login function (I) traditional session login

【Paper】2021_ Uniformity of heterogeneous hybrid multi-level intelligent systems using UGV and UAV

Oculus quest2 development: (I) basic environment construction and guide package

Royal Albert Hall, a popular landmark in London

Issue SSL certificate with IP address

Break through the existing customer group marketing, and try customer grouping management (including clustering model and other practical effect evaluation)

【Paper】2015_ Active fault-tolerant control system design with trajectory re-planning against actuator

為什麼win10開熱點後電腦沒有網絡?
随机推荐
Detailed explanation of the process of "flyingbird" small game (camera adjustment and following part)
图的一些表示方式、邻居和度的介绍
Introduction to some representations, neighbors and degrees of Graphs
Malignant bug: 1252 of unit MySQL export
0 foundation starts self-study unit notes control direction becomes larger
The golden deer, a scenic spot in London -- a sailing museum that tells vivid sailing stories
[control] multi agent system summary. 4. control agreement.
SSL universal domain name certificate
【Paper】2021_ Observer-Based Controllers for Incrementally Quadratic Nonlinear Systems With Disturbanc
Winter vacation parent-child tour, these new york attractions are not only fun but also knowledge
Keywords implements and @override
Is the Flink connector JDBC open source? Where can I download it
One interview question a day the difference between B tree and b+ tree
Connect to the database and run node JS running database shows that the database is missing
Paging query, using jdbc-- paging query
【Paper】2013_ An efficient model predictive control scheme for an unmanned quadrotor helicopter
Differences between beanfactory and factorybean
Dual domain SSL certificate
BeanFactory创建流程
HTC vive cosmos development - handle button event