Web动画形式

本文介绍了Web开发中的动画形式,包括CSS3动画(Transform、Transition、Animation)、JS动画、Canvas动画、SVG动画以及3D动画(如Three.js)。CSS3动画因其简单高效而常用,而复杂的3D动画则可能借助Three.js等库来实现。每种动画形式都有其特点和适用场景。
摘要由CSDN通过智能技术生成

背景

对于Web开发者来说,不管什么细分方向,比如数据可视化、网站系统、电商网站等等,都会涉及到一个难题“动画”。
因为动画关系到Web开发的两个比较重要的点,一是视觉效果,二是用户体验,通过酷炫动画效果可以给视觉加不少分,同样,恰到好处的微动效也会给用户体验带来不错的惊喜,基于此,我们的Web动画该如何实现,他有哪些实现方式呢?

动画形式

大概梳理了下,动画有不止以下几种形式:
一、CSS3动画
二、JS动画
三、Canvas动画
四、SVG动画
五、以Three.js为首的3D动画
针对以上动画形式,我们来简单介绍下吧。

一、CSS3动画

CSS3动画是我目前工作中用到最多的动画形式,因为它书写简单,性能好,不需要懂JavaScript也能写动画,甚至可以实现一些三维立体效果。
CSS3动画又包含几种,比如,transform,transition,animation。

Transform(变形)

transform变包含了rotate(旋转)、scale(缩放)、translate(移动)、skew(扭曲)以及matrix(矩阵变形)。
我们一般会结合transition来使用,使元素变形的过程变的平滑。

Transition(过渡)

CSS3中的transition是让元素的属性值在一定时间区间内平滑过渡,还可以定义变换速率。不是所有的属性都支持过渡的,或者说有很多属性都支持过渡,所以最好还是了解下,没准下次我们就能创造不一样的动画效果了呢!

属性名称 类型
background-color color
background-image only gradients
background-position percentage, length
border-bottom-color color
border-bottom-width length
border-color color
border-left-color color
border-left-width length
border-right-color color
border-right-width length
border-spacing length
border-top-color color
border-top-width length
border-width length
bottom length, percentage
color color
crop rectangle
font-size length, percentage
font-weight number
grid-* various
height length, percentage
left length, percentage
letter-spacing length
line-height number, length, percentage
margin-bottom length
margin-left length
margin-right length
margin-top length
max-height length, percentage
max-width length, percentage
min-height length, percentage
min-width length, percen
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值