css设置动画匀速运动,CSS3 transition动画

1.transition动画

(1)transition-property 设置过渡的属性,比如:width height background-color

(2)transition-duration 设置过渡的时间,比如:1s 500ms

(3)transition-timing-function 设置过渡的运动方式,常用有linear(匀速)| ease(缓冲运动)

(4)transition-delay 设置动画的延迟

(5)transition:property duration timing-function delay; 同时设置

transition动画

.box{

width: 100px;

height: 100px;

background-color: yellow;

transition: all 500ms ease,background-color 2s ease;

}

.box:hover{

width: 500px;

height: 500px;

background-color: red;

}

c24468130ed3b653be70288a9cb3483d.png

例子二:图片说明文字

图片

.box{

width: 320px;

height: 405px;

margin: 50px auto 0;

position: relative;

overflow: hidden;

}

.text{

width: 320px;

height: 100px;

position: absolute;

top: 405px;

background-color: rgba(124,119,119,0.30);

transition: all 500ms ease;

}

.box:hover .text{

position: absolute;

top: 305px;

}

星空

夜空中最亮的星

我在思考人生

d61cc3b8d11379331836aff7b77a160c.png

例子三:夏目

joke

@keyframes joke{

from{

left: 0px;

}

to{

left: -2136px; /*图片宽度*/

}

}

.box{

width: 534px;

height: 300px;

margin: 50px auto;

overflow: hidden;

position: relative;

}

.box img{

position: absolute;

animation: joke 1s steps(4) infinite;

}

夏目友人帐

a58f97cec9d1c35d34c72ecd0982edd8.png

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值