前端简单动画

/* 动画相关属性 */

        /* 1过度动画

            transition

                transition-property:对html元素哪个属性进行处理

                transition-duration:过度动画持续的时间

                transition-timing-function:指定变化的速度

                    linear:线性速度

                    ease:开始较慢,然后加速,速度加到最大再减速

                    ease-in:由慢到快

                    ease-out:由快到慢

        */

        /* 2帧动画

            animation

                animation-name:设置动画的名称

                animation-duration:设置动画持续的时间

                animation-timing-function:指定变化的速度

                    linear:线性速度

                    ease:开始较慢,然后加速,速度加到最大再减速

                    ease-in:由慢到快

                    ease-out:由快到慢

                animation-delay:设置帧动画的延迟时间

                animation-iteration-count:设置帧动画执行的次数  infinite无限次执行

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

        */

定义动画:

@keyframes identifier {
            to {
                color: #f0932b;
                text-shadow: 20px 0 35px #9c88ff;
            }
        }

css例子:

* {
            margin: 0;
            padding: 0;
        }
        
        body {
            background: black;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        .text span {
            margin: 0 20px;
            color: aqua;
            /* 文字阴影 */
            text-shadow: 20px 0 35px #eb4d4b;
            font-size: 20vh;
            font-weight: 600;
            animation-name: identifier;
            animation-duration: 1s;
            animation-iteration-count: infinite;
            animation-direction: alternate;
        }
        
        .text span:nth-child(2) {
            animation-delay: 0.2s;
        }
        
        .text span:nth-child(3) {
            animation-delay: 0.3s;
        }
        
        .text span:nth-child(4) {
            animation-delay: 0.4s;
        }
        
        .text span:nth-child(5) {
            animation-delay: 0.5s;
        }
        
        .text span:nth-child(6) {
            animation-delay: 0.6s;
        }
        
        .text span:nth-child(7) {
            animation-delay: 0.7s;
        }
        
        .text span:nth-child(8) {
            animation-delay: 0.8s;
        }

html例子:

<body>
    <div class="text">
        <span>I</span>
        <span>L</span>
        <span>O</span>
        <span>V</span>
        <span>E</span>
        <span>Y</span>
        <span>O</span>
        <span>U</span>
    </div>
</body>

结果呈现:

前端动画

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值