当前位置:网站首页>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适用于图像密集型游戏。
边栏推荐
- 【Paper】2015_ Active fault-tolerant control system design with trajectory re-planning against actuator
- 0 foundation starts self-study unit notes control direction becomes larger
- IO stream, buffer stream, automatic resource management
- Process architecture and process management
- Connect to the database and run node JS running database shows that the database is missing
- One interview question a day the difference between B tree and b+ tree
- BeanFactory创建流程
- Static keyword
- Output directory of log files after unity3d packaging
- 史上最全的Redis基础+进阶项目实战总结笔记
猜你喜欢

Check London attractions suitable for parents and children in winter vacation

Issue SSL certificate with IP address

Network high concurrency

Directory operations and virtual file systems

Redis实现短信登入功能(二)Redis实现登入功能

System programming summary

IIS request SSL certificate

Malignant bug: 1252 of unit MySQL export

Create transfer generation point

Learning about signals
随机推荐
harbor api 2.0查询
圆心科技,很焦虑?
Marvel fan welfare: Singapore Madame Tussauds Wax Museum Marvel 4D experience Museum
Unity is associated with vs. there is a compiler problem when opening
Is the Flink connector JDBC open source? Where can I download it
Static keyword
File system and directory operations
Qos(Quality of Service)
Redis实现短信登入功能(一)传统的Session登入
Geotrustov wildcard
Webots notes day 2
Create a simple battle game with photon pun
Brew install NVM command not found solution
[UAV] gyroscope data analysis, taking Victor intelligent jy901b as an example
【Paper】2016_ A Learning-Based Fault Tolerant Tracking Control of an Unmanned Quadrotor Helicopter
The most comprehensive summary notes of redis foundation + advanced project in history
brew安装nvm报nvm command not found解决方案
Singapore must visit these scenic spots during the Spring Festival
【Paper】2020_ Research on defense and evaluation strategy of heterogeneous UAV formation_ Zuojiankai
Universal Studios Singapore: a good place for a one-day parent-child tour in Singapore