css动画效果

1、通过CSS3,也可以进行创建动画了
2, CSS3的动画需要遵循@keyframes规则
规定动画的时长
规定动画的名称
语法:animation: name duration (完成时间)
timing-function (完成的方式)
iteration-count (完成的次数)
fill-mode(动画不执行时的显示)
play-state(询问动画执行或暂停);

value值: linear(相同的速度)
N(次数)
norma(默认正常播放)
none(默认开始时的样子)
ease (默认,先慢中间快后面慢)
infinite(无线循环)
reverse(反向播放)
ease-in(慢速开始)
forwards(to值得设置)
running(运行)
backwards(from值得设置)
ease-out(以慢速结束)
ease-in-out(全程慢速)
paused(暂停)

@keyframes name{

from{}
50%{}
to{}

}

参数一:绑定在keyframes上名称【必须要】 animmation-name 指定要绑定到选择器的关键帧名称

参数二:完成动画所需要的时间,s/ms【必须要】 annimation-duration 完成动画所需要的时间 单位 s或 ms

参数三:动画开始之前的延迟,s/ms 【若不写默认为0】 annimation-delay

参数四:动画执行的次数【若不写,默认1】 animation-interation-counnt

参数五:动画的运动曲线 【若不写,默认ease】

参数六:动画是否轮流反向执行【若不写,默认normal】

参数七:是否保留动画结束之后的状态【若不写,默认不保留】
例子代码:
yuan1{animation: zhuanba 3s 0s infinite linear alternate; }
@keyframes zhuanba{
from{
transform: rotate(0deg) scale(1);
background: wheat;
}
50%{
transform: rotate(180deg) scale(1.5);
background: yellow;
}
to{
transform: rotate(360deg) scale(1);
background: red;
}
}

猜你喜欢

转载自blog.csdn.net/qq_39222965/article/details/80273353