CSS--动画特效

前言

这个是转载自他人博客,我只是纯粹的从它的代码学习一些东西,然后给大家讲解下!
原文

代码
<video src="https://klxxcdn.oss-cn-hangzhou.aliyuncs.com/histudy/hrm/media/08reverse.mp4" autoplay muted></video>
  <h2><span>We</span> must uni<span>te a</span>gainst COVID-19</h2>
* {
        margin: 0;
        padding: 0;
        font-family: 'Poppins', sans-serif;
    }

    body {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        background: #000;
    }

    h2 {
        position: relative;
        font-size: 3.4em;
        font-weight: 900;
        color: #fff;
        z-index: 1;
        overflow: hidden;
        margin: 20px 20px 0 0;
    }

    h2 span {
        color: #ff022c;
    }
	/*这里是做为文字的遮挡层,加一个从左到后的动画就可以实现文字逐渐出现的效果*/
    h2::before {
        content: '';
        position: absolute;
        left: -20%;
        width: 120%;
        height: 100%;
        background: linear-gradient(90deg, transparent 0%, #000 5%, #000 100%);
        animation: animate 5.5s linear forwards;
        animation-delay: 2s;

    }

    @keyframes animate {
        0% {
            left: -20%;
        }

        100% {
            left: 110%;
        }
    }

    video {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        z-index: 2;
        pointer-events: none;
        /*这里注意一下文字是在video的下面,要能对文字进行操作的话就需要设置上面那个属性*/
        mix-blend-mode: screen;
        /*screen 滤色*/
    }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值