CSS-过渡效果和动画效果

Transition
过渡效果
transition: property duration timing-function delay

例子:
transition: background-color 1s linear 1s, color 1s linear;

property
CSS属性名称

duration
时长(2s / 2ms)

time-function
播放速度
time-function:(linear | ease | ease-in | ease-out | ease-in-out | cubic-bezier(n,n,n,n))
linear - 线性速度
ease - 慢速开始,然后变快
ease-in - 慢速开始
ease-out - 慢速结束
ease-in-out - 慢速开始和慢速结束
 
delay
在过渡前等待(2s / 2ms)



Animations
动画效果
@keyframes mycolor{
     0%{
          background-color: red;
     }
     40%{
          background-color: darkblue;
     }
     100%{
          background-color: yellow;
     }
}
div:hover{
     animation-name: mycolor;
     animation-duration: 2s;
     animation-timing-function: linear;
}

@keyframes - 定义动画规则
n% - 定义关键帧
animation-name - 动画名称
animation-duration - 时长
animation-timing-function - 播放速度
animation-delay - 播放前等待
animation-iteration-count - 播放次数(默认1 n|infinite)
animation-direction - 在下一周期是否逆向播放(normal | alternate)
animation-play-state - 播放状态(paused | running)
animation-fill-mode - 播放完成后的状态(none | forwards | backwards | both)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值