纯css实现图片闪屏故障动画特效
代码语言:html
所属分类:视觉差异
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Image glitch effect</title>
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Bungee'>
<style>
:root {
--color-text: #fff;
--color-bg: #000;
--color-link: #f9d77e;
--color-link-hover: #fff;
--color-info: #efc453;
--glitch-width: 100vw;
--glitch-height: 100vh;
--gap-horizontal: 10px;
--gap-vertical: 5px;
--time-anim: 4s;
--delay-anim: 2s;
--blend-mode-1: none;
--blend-mode-2: none;
--blend-mode-3: none;
--blend-mode-4: none;
--blend-mode-5: overlay;
--blend-color-1: transparent;
--blend-color-2: transparent;
--blend-color-3: transparent;
--blend-color-4: transparent;
--blend-color-5: #af4949;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
body {
background-color: #1D1E22;
margin: 0;
padding: 0;
}
.glitch {
width: 100vw;
height: 100vh;
max-width: 100%;
position: relative;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
}
.glitch .glitch__item {
background: url("http://repo.bfw.wiki/bfwrepo/image/slicebox/4.jpg") no-repeat 50% 50%/cover;
height: 100%;
width: 100%;
top: 0;
left: 0;
position: absolute;
}
.glitch .glitch__item:nth-child(n+2) {
opacity: 0;
animation-duration: var(--time-anim);
animation-delay: var(--delay-anim);
animation-timing-function: linear;
animation-iteration-count: infinite;
}
.glitch .glitch__item:nth-child(2) {
background-color: var(--blend-color-2);
background-blend-mode: var(--blend-mode-2);
animation-name: glitch-anim-2;
}
.glitch .glitch__item:nth-child(2) {
background-color: var(--blend-color-3);
background-blend-mode: var(--blend-mode-3);
animation-name: glitch-anim-3;
}
.glitch .glitch__item:nt.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0