纯CSS炫酷文字故障动画效果

当前位置:主页 > CSS3库 > CSS3动画 > 纯CSS炫酷文字故障动画效果
纯CSS炫酷文字故障动画效果
分享:

    插件介绍

    这是一款纯CSS炫酷文字故障动画效果,该特效利用多层文字的动画效果,来模拟电子设备故障时的文字横条闪烁效果,非常炫酷。

    浏览器兼容性

    浏览器兼容性
    时间:05-29
    阅读:
简要教程

这是一款纯CSS炫酷文字故障动画效果,该特效利用多层文字的动画效果,来模拟电子设备故障时的文字横条闪烁效果,非常炫酷。

使用方法

HTML代码
<div class="glitch">
    <div class="line"><i class="fa-solid fa-triangle-exclamation"></i> FATAL ERROR <i class="fa-solid fa-triangle-exclamation"></i></div>
    <div class="line"><i class="fa-solid fa-triangle-exclamation"></i> FATAL ERROR <i class="fa-solid fa-triangle-exclamation"></i></div>
    <div class="line"><i class="fa-solid fa-triangle-exclamation fa-beat"></i> FATAL ERROR <i class="fa-solid fa-triangle-exclamation"></i></div>
    <div class="line"><i class="fa-solid fa-triangle-exclamation"></i> FATAL ERROR <i class="fa-solid fa-triangle-exclamation"></i></div>
    <div class="line"><i class="fa-solid fa-triangle-exclamation"></i> FATAL ERROR <i class="fa-solid fa-triangle-exclamation"></i></div>
    <div class="line"><i class="fa-solid fa-shapes"></i> FATAL ERROR <i class="fa-solid fa-triangle-exclamation fa-beat"></i></div>
    <div class="line"><i class="fa-solid fa-triangle-exclamation"></i> FATAL ERROR <i class="fa-solid fa-triangle-exclamation"></i></div>
    <div class="line"><i class="fa-solid fa-triangle-exclamation"></i> FATAL ERROR</div>
    <div class="line"><i class="fa-solid fa-triangle-exclamation fa-shake"></i> FATAL ERROR</div>
    <div class="line"><i class="fa-solid fa-triangle-exclamation"></i> FATAL ERROR <i class="fa-solid fa-triangle-exclamation"></i></div>
</div>
		

CSS代码

.glitch {
  position: relative;
  color: #fff;
  font-size: 60px;
}

.line:not(:first-child) {
  position: absolute;
  top: 0;
  left: 0;
}
.line:nth-child(1) {
  animation: clip 3000ms -300ms linear infinite, glitch1 500ms -420ms linear infinite;
}
@keyframes glitch1 {
  0% {
    transform: translateX(0);
  }
  80% {
    transform: translateX(0);
    color: #fff;
  }
  85% {
    transform: translateX(0px);
    color: #4e9a26;
  }
  90% {
    transform: translateX(5px);
    color: #ac1212;
  }
  95% {
    transform: translateX(1px);
    color: #fff;
  }
  100% {
    transform: translateX(0);
  }
}
.line:nth-child(2) {
  animation: clip 3000ms -600ms linear infinite, glitch2 500ms -543ms linear infinite;
}
@keyframes glitch2 {
  0% {
    transform: translateX(0);
  }
  80% {
    transform: translateX(0);
    color: #fff;
  }
  85% {
    transform: translateX(-3px);
    color: #4e9a26;
  }
  90% {
    transform: translateX(-4px);
    color: #ac1212;
  }
  95% {
    transform: translateX(5px);
    color: #fff;
  }
  100% {
    transform: translateX(0);
  }
}
.line:nth-child(3) {
  animation: clip 3000ms -900ms linear infinite, glitch3 500ms -460ms linear infinite;
}
@keyframes glitch3 {
  0% {
    transform: translateX(0);
  }
  80% {
    transform: translateX(0);
    color: #fff;
  }
  85% {
    transform: translateX(4px);
    color: #4e9a26;
  }
  90% {
    transform: translateX(-2px);
    color: #ac1212;
  }
  95% {
    transform: translateX(4px);
    color: #fff;
  }
  100% {
    transform: translateX(0);
  }
}
.line:nth-child(4) {
  animation: clip 3000ms -1200ms linear infinite, glitch4 500ms -618ms linear infinite;
}
@keyframes glitch4 {
  0% {
    transform: translateX(0);
  }
  80% {
    transform: translateX(0);
    color: #fff;
  }
  85% {
    transform: translateX(-4px);
    color: #4e9a26;
  }
  90% {
    transform: translateX(4px);
    color: #ac1212;
  }
  95% {
    transform: translateX(1px);
    color: #fff;
  }
  100% {
    transform: translateX(0);
  }
}
.line:nth-child(5) {
  animation: clip 3000ms -1500ms linear infinite, glitch5 500ms -279ms linear infinite;
}
@keyframes glitch5 {
  0% {
    transform: translateX(0);
  }
  80% {
    transform: translateX(0);
    color: #fff;
  }
  85% {
    transform: translateX(-2px);
    color: #4e9a26;
  }
  90% {
    transform: translateX(-4px);
    color: #ac1212;
  }
  95% {
    transform: translateX(-1px);
    color: #fff;
  }
  100% {
    transform: translateX(0);
  }
}
.line:nth-child(6) {
  animation: clip 3000ms -1800ms linear infinite, glitch6 500ms -607ms linear infinite;
}
@keyframes glitch6 {
  0% {
    transform: translateX(0);
  }
  80% {
    transform: translateX(0);
    color: #fff;
  }
  85% {
    transform: translateX(2px);
    color: #4e9a26;
  }
  90% {
    transform: translateX(-2px);
    color: #ac1212;
  }
  95% {
    transform: translateX(-3px);
    color: #fff;
  }
  100% {
    transform: translateX(0);
  }
}
.line:nth-child(7) {
  animation: clip 3000ms -2100ms linear infinite, glitch7 500ms -45ms linear infinite;
}
@keyframes glitch7 {
  0% {
    transform: translateX(0);
  }
  80% {
    transform: translateX(0);
    color: #fff;
  }
  85% {
    transform: translateX(-2px);
    color: #4e9a26;
  }
  90% {
    transform: translateX(-1px);
    color: #ac1212;
  }
  95% {
    transform: translateX(0px);
    color: #fff;
  }
  100% {
    transform: translateX(0);
  }
}
.line:nth-child(8) {
  animation: clip 3000ms -2400ms linear infinite, glitch8 500ms -823ms linear infinite;
}
@keyframes glitch8 {
  0% {
    transform: translateX(0);
  }
  80% {
    transform: translateX(0);
    color: #fff;
  }
  85% {
    transform: translateX(1px);
    color: #4e9a26;
  }
  90% {
    transform: translateX(1px);
    color: #ac1212;
  }
  95% {
    transform: translateX(2px);
    color: #fff;
  }
  100% {
    transform: translateX(0);
  }
}
.line:nth-child(9) {
  animation: clip 3000ms -2700ms linear infinite, glitch9 500ms -575ms linear infinite;
}
@keyframes glitch9 {
  0% {
    transform: translateX(0);
  }
  80% {
    transform: translateX(0);
    color: #fff;
  }
  85% {
    transform: translateX(3px);
    color: #4e9a26;
  }
  90% {
    transform: translateX(0px);
    color: #ac1212;
  }
  95% {
    transform: translateX(1px);
    color: #fff;
  }
  100% {
    transform: translateX(0);
  }
}
.line:nth-child(10) {
  animation: clip 3000ms -3000ms linear infinite, glitch10 500ms -377ms linear infinite;
}
@keyframes glitch10 {
  0% {
    transform: translateX(0);
  }
  80% {
    transform: translateX(0);
    color: #fff;
  }
  85% {
    transform: translateX(-2px);
    color: #4e9a26;
  }
  90% {
    transform: translateX(3px);
    color: #ac1212;
  }
  95% {
    transform: translateX(-1px);
    color: #fff;
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes clip {
  0% {
    clip-path: polygon(0 -20%, 100% -20%, 100% 0%, 0 0);
  }
  100% {
    clip-path: polygon(0 100%, 100% 100%, 100% 120%, 0 120%);
  }
}
		

codepen网址:https://codepen.io/tommyho/pen/GRLrVjR