css怎么闪烁文字,css文字闪烁效果

}h1.fb-glitch{position:relative;color:#abff79;

}h1.fb-glitch:before{left:-2px;text-shadow:2px 0 #0b391a;animation:glitch-anim-2 3s infinite linear alternate-reverse;

}h1.fb-glitch:before, h1.fb-glitch:after{content:attr(data-text);position:absolute;top:0;left:0;width:100%;clip:rect(0, 0, 0, 0);

}h1.fb-glitch:after{left:2px;text-shadow:-1px 0 #1b5c16;animation:glitch-anim-1 2s infinite linear alternate-reverse;

}@keyframes glitch-anim-1{0% {

clip:rect(82px, 820px, 98px, 0); }5.8823529412%{clip:rect(17px, 820px, 4px, 0); }11.7647058824%{clip:rect(24px, 820px, 44px, 0); }17.6470588235%{clip:rect(24px, 820px, 111px, 0); }23.5294117647%{clip:rect(29px, 820px, 45px, 0); }29.4117647059%{clip:rect(114px, 820px, 115px, 0); }35.2941176471%{clip:rect(103px, 820px, 22px, 0); }41.1764705882%{clip:rect(49px, 820px, 32px, 0); }47.0588235294%{clip:rect(2px, 820px, 10px, 0); }52.9411764706%{clip:rect(80px, 820px, 44px, 0); }58.8235294118%{clip:rect(70px, 820px, 30px, 0); }64.7058823529%{clip:rect(27px, 820px, 79px, 0); }70.5882352941%{clip:rect(82px, 820px, 112px, 0); }76.4705882353%{clip:rect(27px, 820px, 2px, 0); }82.3529411765%{clip:rect(47px, 820px, 104px, 0); }88.2352941176%{clip:rect(53px, 820px, 102px, 0); }94.1176470588%{clip:rect(2px, 820px, 90px, 0); }100%{clip:rect(88px, 820px, 56px, 0); }}

@keyframes glitch-anim-2{0% {

clip:rect(88px, 820px, 68px, 0); }5.8823529412%{clip:rect(75px, 820px, 113px, 0); }11.7647058824%{clip:rect(80px, 820px, 40px, 0); }17.6470588235%{clip:rect(70px, 820px, 51px, 0); }23.5294117647%{clip:rect(47px, 820px, 78px, 0); }29.4117647059%{clip:rect(61px, 820px, 7px, 0); }35.2941176471%{clip:rect(94px, 820px, 1px, 0); }41.1764705882%{clip:rect(26px, 820px, 69px, 0); }47.0588235294%{clip:rect(91px, 820px, 62px, 0); }52.9411764706%{clip:rect(8px, 820px, 78px, 0); }58.8235294118%{clip:rect(17px, 820px, 97px, 0); }64.7058823529%{clip:rect(66px, 820px, 48px, 0); }70.5882352941%{clip:rect(66px, 820px, 85px, 0); }76.4705882353%{clip:rect(46px, 820px, 12px, 0); }82.3529411765%{clip:rect(69px, 820px, 68px, 0); }88.2352941176%{clip:rect(38px, 820px, 7px, 0); }94.1176470588%{clip:rect(83px, 820px, 32px, 0); }100%{clip:rect(110px, 820px, 95px, 0); }}

花花世界

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要实现CSS文字逐行出现的效果,可以借助CSS的animation和@keyframes属性,以下是一个简单的例子: ```html <p class="typewriter">Hello World!</p> ``` ```css .typewriter{ overflow: hidden; /* 隐藏文字内容 */ border-right: .15em solid orange; /* 光标闪烁 */ white-space: nowrap; /* 不换行 */ font-size: 30px; /* 体大小 */ letter-spacing: .15em; /* 母间距 */ animation: typing 3.5s steps(30, end), blink-caret .75s step-end infinite; /* 逐出现和光标闪烁 */ } @keyframes typing { from { width: 0 } to { width: 100% } } @keyframes blink-caret { from, to { border-color: transparent } 50% { border-color: orange } } ``` 在上面的代码中,我们定义了一个名为"typewriter"的类,通过设置overflow:hidden属性,将文字内容隐藏起来。接着,我们使用border-right属性模拟光标闪烁效果,并设置white-space属性为nowrap,保证文字不会换行。我们还设置了体大小和母间距等样式。 最关键的部分是定义逐行出现的动画效果。我们通过animation属性将两个关键帧动画"typing"和"blink-caret"应用到.typewriter类上。其中,"typing"动画通过控制宽度从0到100%的变化来实现逐行出现的效果。"blink-caret"动画则控制光标的颜色在透明和橙色之间切换,模拟光标闪烁效果。 通过这种方式,文字就会在页面加载后逐行出现,并伴随着光标闪烁效果。您可以通过修改动画效果的属性值来实现不同的效果
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值