- 随时间线进行的动画
- 2.hover触发动画:
animation-name: qwer(名称随意);
@keyframes qwer(定义的动画名称) {
form{
width: 100px;
}to{
width: 200px;
(transform: rotate(360deg)(角度))
}
}
animation-iteration-count: infinite(循环)/n(动画循环次数);
animation-duration (动画时长)
animation-timing-function (动画速度曲线){
--transition-property 规定设置过渡效果的 CSS 属性的名称。none没有过渡 all 全都过渡
--transition-duration 规定完成过渡效果需要多少秒或毫秒。 后接时间
--transition-timing-function 规定速度效果的速度曲线。{
linear 规定以相同速度开始至结束的过渡效果(等于 cubic-bezier(0,0,1,1))。
ease 规定慢速开始,然后变快,然后慢速结束的过渡效果(cubic-bezier(0.25,0.1,0.25,1))。
ease-in 规定以慢速开始的过渡效果(等于 cubic-bezier(0.42,0,1,1))。
ease-out 规定以慢速结束的过渡效果(等于 cubic-bezier(0,0,0.58,1))。
ease-in-out 规定以慢速开始和结束的过渡效果(等于 cubic-bezier(0.42,0,0.58,1))
}
例:animation-timing-function:,,,;(速度一致时长两秒)
animation-delay (动画开始延迟)
animation-direction: normal(正常播放)alternate;(循环反向播放)
@keyframes bianse {
0%{
width: 0px;
height: 0px;
background-color: cornflowerblue;
}100%{
width: 1920px;
height: 937px;
background-color: #fff;
}
}
--transition-property 规定设置过渡效果的 CSS 属性的名称。none没有过渡 all 全都过渡
--transition-duration 规定完成过渡效果需要多少秒或毫秒。 后接时间
--transition-timing-function 规定速度效果的速度曲线。{
linear 规定以相同速度开始至结束的过渡效果(等于 cubic-bezier(0,0,1,1))。
ease 规定慢速开始,然后变快,然后慢速结束的过渡效果(cubic-bezier(0.25,0.1,0.25,1))。
ease-in 规定以慢速开始的过渡效果(等于 cubic-bezier(0.42,0,1,1))。
ease-out 规定以慢速结束的过渡效果(等于 cubic-bezier(0,0,0.58,1))。
ease-in-out 规定以慢速开始和结束的过渡效果(等于 cubic-bezier(0.42,0,0.58,1))
}
--transition-delay 定义过渡效果何时开始 后接时间