html过渡动画transiton,帧动画animation

过渡动画transiton

多个动画逗号隔开 transition:border 2s linear,width 1s linear 它的属性有:

  1. transition-property设置指定属性进行过渡动画
  2. transition-duration动画持续时间
  3. transition-timing-function设置动画渐变速度, linear:匀速 ease:由慢到快 由快到慢 ease-in:由慢到快 ease-out由快到慢 ease-in-out(由慢到快 由快到慢 )
  4. transition-dalay设置动画延迟时间,点开始后五秒后才开始动画

帧动画animation

1.animation-name设置动画名称

2.animation-duration设置动画持续时间

3.animation-timing-function设置动画渐变速度 linear:匀速 ease:由慢到快 由快到慢 ease-in:由慢到快 ease-out由快到慢 ease-in-out(由慢到快 由快到慢 )

4.animation-dalay设置动画延迟时间

5.animation-iteration-count 设置动画执行次数 无限次infinite

6.animation-direction 值有alternate(交替) 动画在奇数次正向播放,偶数次反向播放

7.animation-play-state设置动画播放状态 paused暂停 帧动画

定义 @keyframes 动画名称
{ 百分数|to|from
    { .... } 
 ...... }

案例:流动的水滴 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        @keyframes zz{
            20%{border-radius: 50% 50% 69% 31% / 50% 34% 66% 50% ;}
            50%{border-radius: 64% 36% 29% 71%/50% 62% 38% 50% ;}
            to{
                border-radius: 50% 50% 69% 31% / 50% 49% 51% 50% ;
            }
        }
        *{
            margin: 0;
            padding: 0;
        }
        body{
            display: flex;
        height: 100vh;
            background-color: rgba(29, 122, 122, 0.162);
            justify-content: center;
            align-items: center;
        }
        .box{
            width: 200px;
            height: 200px;
            box-shadow: 10px 10px 20px rgb(0,0,0,0.3) inset,-10px -10px 10px rgba(82, 79, 79, 0.3) inset,15px 15px 15px rgb(0,0,0,0.3) ;
            border-radius: 48% 52% 63% 37% / 60% 49% 51% 40% ;
            animation: zz 2s alternate infinite;
            position: relative;
        }
        .box::after{
            content: "";
            width: 10px;
            height: 10px;
            position: absolute;
            background-color:rgba(255, 250, 250, 0.67);
            border-radius:  48% 52% 63% 37% / 60% 49% 51% 40%  ;
            left: 63px;
    top: 35px;
        }
        .box::before{
            content: "";
    width: 13px;
    height: 12px;
    position: absolute;
    background-color: rgba(255, 250, 250, 0.67);
    border-radius: 76% 24% 69% 31% / 76% 12% 88% 24%;
    left: 85px;
    top: 48px;
        }
    </style>
</head>
<body>
    <div class="box">
    </div>
</body>
</html>

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值