バーコードスキャンビームBarcode Scan Beam
.cg-ld-scan {
position: relative;
width: 120px;
height: 56px;
border-radius: 6px;
overflow: hidden;
border: 2px solid #1B1A17;
background: repeating-linear-gradient(
90deg,
#1B1A17 0, #1B1A17 3px,
transparent 3px, transparent 6px,
#1B1A17 6px, #1B1A17 7px,
transparent 7px, transparent 11px,
#1B1A17 11px, #1B1A17 14px,
transparent 14px, transparent 20px
), #F5F2EA;
animation: cg-ld-scan-body 3s ease infinite;
}
/* 読み取り光線: 下降→上昇の2往復目で読み取り完了 */
.cg-ld-scan .beam {
position: absolute;
left: 0;
right: 0;
top: 0;
height: 3px;
background: #F2B707;
box-shadow: 0 0 10px 2px rgba(242, 183, 7, .85);
animation: cg-ld-scan-move 3s cubic-bezier(.45, .05, .55, .95) infinite;
}
/* 光線が通過した範囲を「読み取り済み」として明るく残す */
.cg-ld-scan .lit {
position: absolute;
left: 0;
right: 0;
top: 0;
background: rgba(242, 183, 7, .22);
animation: cg-ld-scan-lit 3s cubic-bezier(.45, .05, .55, .95) infinite;
}
/* 完了チェック: ばねで飛び出す */
.cg-ld-scan .ok {
position: absolute;
left: 50%;
top: 50%;
width: 20px;
height: 11px;
margin: -9px 0 0 -10px;
border: solid #2F8A59;
border-width: 0 0 4px 4px;
transform: rotate(-45deg) scale(0);
animation: cg-ld-scan-ok 3s cubic-bezier(.34, 1.56, .64, 1) infinite;
}
@keyframes cg-ld-scan-move {
0% { top: 0; opacity: 1; }
30% { top: calc(100% - 3px); }
58% { top: 0; opacity: 1; }
64%, 100% { top: 0; opacity: 0; }
}
@keyframes cg-ld-scan-lit {
0% { height: 0; }
30% { height: 100%; }
58% { height: 100%; }
70%, 100% { height: 0; }
}
@keyframes cg-ld-scan-ok {
0%, 60% { transform: rotate(-45deg) scale(0); }
70% { transform: rotate(-45deg) scale(1.25); }
76%, 92% { transform: rotate(-45deg) scale(1); }
100% { transform: rotate(-45deg) scale(0); }
}
@keyframes cg-ld-scan-body {
0%, 60% { border-color: #1B1A17; }
70%, 92% { border-color: #2F8A59; }
100% { border-color: #1B1A17; }
}
@media (prefers-reduced-motion: reduce) {
.cg-ld-scan, .cg-ld-scan .beam, .cg-ld-scan .lit, .cg-ld-scan .ok { animation: none; }
.cg-ld-scan .beam { opacity: 0; }
.cg-ld-scan .lit { height: 100%; }
.cg-ld-scan .ok { transform: rotate(-45deg) scale(1); }
.cg-ld-scan { border-color: #2F8A59; }
}
<div class="cg-ld-scan" role="status" aria-label="スキャン中"><i class="beam" aria-hidden="true"></i><i class="lit" aria-hidden="true"></i><b class="ok" aria-hidden="true"></b></div>