<div class="scan">
<div class="qrcode"></div>
<h3>二维码扫描中...</h3>
<div class="border"></div>
</div>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: consolas;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #111;
}
.scan {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
}
.scan .qrcode {
position: relative;
width: 400px;
height: 400px;
background: url(https://mankeung.github.io/docs/mk-data/w.jpg);
background-size: 330px;
background-position: center;
background-repeat: no-repeat;
}
.scan .qrcode::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: url(https://mankeung.github.io/docs/mk-data/border.png);
background-size: 400px;
overflow: hidden;
animation: animate 4s ease-in-out infinite;
}
@keyframes animate {
0%,
100% {
height: 20px;
}
50% {
height: calc(100% - 20px);
}
}
.scan .qrcode::after {
content: '';
position: absolute;
inset: 20px;
width: calc(100% - 40px);
height: 2px;
background: #35fd5c;
filter: drop-shadow(0 0 20px #35fd5c) drop-shadow(0 0 60px #35fd5c);
animation: animate_line 4s ease-in-out infinite;
}
@keyframes animate_line {
0%,
100% {
top: 20px;
}
50% {
top: calc(100% - 20px);
}
}
.border {
position: absolute;
inset: 0px;
background: url(https://mankeung.github.io/docs/mk-data/border.png);
background-size: 400px;
background-repeat: no-repeat;
animation: animate_text 0.5s linear infinite;
}
@keyframes animate_text {
0%,
100% {
opacity: 0;
}
50% {
opacity: 1;
}
}
.scan h3 {
text-transform: uppercase;
font-size: 2em;
letter-spacing: 2px;
margin-top: 20px;
color: #fff;
filter: drop-shadow(0 0 20px #fff) drop-shadow(0 0 60px #fff);
animation: animate_text 0.5s steps(1) infinite;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.