当前位置:网站首页>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适用于图像密集型游戏。
边栏推荐
- How to apply for SSL certificate from the manufacturer
- 【Paper】2021_ Observer-Based Controllers for Incrementally Quadratic Nonlinear Systems With Disturbanc
- 力扣2049:统计最高分的节点数目
- Geotrustov wildcard
- Bean creation process and lazy init delay loading mechanism
- [control] multi agent system summary. 4. control agreement.
- Why does the computer have no network after win10 is turned on?
- EasyRecovery数据恢复软件 恢复了我两年前的照片视频数据
- 深度学习------不同方法实现Inception-10
- Learn about threads
猜你喜欢

Wildcard SSL certificate issuing time

Royal Albert Hall, a popular landmark in London

Approaching history, introduction to the London Guard Museum

This connection is not a private connection this website may be pretending to steal your personal or financial information

Unity is associated with vs. there is a compiler problem when opening

The most comprehensive summary notes of redis foundation + advanced project in history

Sectigo certificate

Introduction to system programming

Photon pun refresh hall room list

Learn about threads
随机推荐
Unit screenshot saved on the phone
Geotrustov wildcard
Beanfactory creation process
Meet in Bangkok for a romantic trip on Valentine's Day
Efficiency test of adding and querying ArrayList and LinkedList
What is multimodal interaction?
Draw on screen border in Commodore 64
Directory operations and virtual file systems
SSL update method
Why does the computer have no network after win10 is turned on?
One interview question a day the difference between B tree and b+ tree
Autowired注解警告的解决办法
Moore Manor diary I: realize the reclamation, sowing, watering and harvest in Moore Manor
EasyRecovery数据恢复软件 恢复了我两年前的照片视频数据
Threejs realizes the simulation of river, surface flow, pipe flow and sea surface
Qos(Quality of Service)
Threadlocal
IIS request SSL certificate
Differences between beanfactory and factorybean
Static keyword