CSS(动画) 笔记 07

一 . 秒变(鼠标接触)

div{

    width: 200px;

    height:200px;

    background: palegreen;

}



div:hover{

    height:100px;

    width:100px;

    opacity: 0.5;

    background: darkorange;

}

二. 

1.过渡动画 transition 复合属性

①transition-property  指定html元素的哪个css属性及逆行平滑渐变处理

②transition-duration  指定平滑渐变持续的时间

③transition-timing-function 渐变的速度 支持如下几个值:

   ease

   linear

   ease-in

   ease-out

div{
    width: 200px;
    height:200px;
    background: palegreen;
    transition-property: all;
    transition-duration:4s ;
    transition-timing-function: ease;
}
div:hover{
    height:100px;
    width:100px;
    opacity: 0.5;
    background: url(hh.jpg);
    
} 

2. 帧动画 animation

animation-name 设置动画名称(配合@keyframes name使用)

animation-duration 执行持续时间

animation-timing-function 渐变的速度

animation-delay   执行前延迟时间

animation-iteration-count  执行次数(infinite无数次执行)

animation-direction  设置动画的方向 (alternate交替)

 @Keyframes name{

    from|to|百分比{

        属性1:值;

        属性2:值;

    }

}

@keyframes aaa{
    50%{
        height:100px;
        width:100px;
        opacity: 0.5;
        background: coral;
    }
    25%{
        background: red;
        border-radius: 50px;
    }
    100%{
        width: 200px;
        height:200px;
        background: palegreen; 
     
    }
}

div{
    width: 200px;
    height:200px;
    background: blueviolet;
    animation-name:aaa;
    animation-duration: 3s;
    animation-timing-function: linear;
    animation-delay: 1s; 
    animation-iteration-count: infinite;
    animation-direction: alternate;
   
}

 3.一个有趣的动画

  <style>
        body{
    display: flex;
    align-items: center;
    height:100vh;
    justify-content: center;
    background: green;
          }

          span{
            font-size: 10vh;
            color:pink;
            font-weight: 600;
            margin:15px;
            animation: aaa 1s ease infinite alternate ; 
          }
          /* 默认开始 */
          @keyframes aaa{
            20%{
                color:aqua
            }
            50%{
                color: red;
                font-size: 20vh;
                text-shadow: 0 0 100px floralwhite;
            }

          }
          .container span:nth-child(1){
            animation-delay: 0.16s;
          }
          .container span:nth-child(2){
            animation-delay: 0.32s;
          }
          .container span:nth-child(3){
            animation-delay: 048s;
          }
          .container span:nth-child(4){
            animation-delay: 0.64s;
          }
          .container span:nth-child(5){
            animation-delay: 0.80s;
          }
          .container span:nth-child(6){
            animation-delay: 1s;
          }


    </style>
</head>
<body>
    <div class="container">
        <span>跳</span>
        <span>楼</span>
        <span>价</span>
        <span>8</span>
        <span>8</span>
        <span>8</span>
    </div>
    
</body>

  • 11
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值