JSFiddle - React, Tailwind, and code Playground
HTML
<input type="checkbox" id="random">
<label class="box" for="random"></label>
CSS
@property --c1{
syntax: '<integer>';
inherits: false;
initial-value: 1;
}
@property --c2{
syntax: '<integer>';
inherits: false;
initial-value: 1;
}
@property --c3{
syntax: '<integer>';
inherits: false;
initial-value: 1;
}
@property --c4{
syntax: '<integer>';
inherits: false;
initial-value: 1;
}
@property --c5{
syntax: '<integer>';
inherits: false;
initial-value: 1;
}
@property --c6{
syntax: '<integer>';
inherits: false;
initial-value: 1;
}
@property --c7{
syntax: '<integer>';
inherits: false;
initial-value: 1;
}
.box {
--c:black; /* color */
--s:0.5ch; /* space between numbers */
--b:10px; /* transparent border*/
counter-set:c1 var(--c1) c2 var(--c2) c3 var(--c3) c3 var(--c3) c4 var(--c4) c5 var(--c5) c6 var(--c6) c7 var(--c7);
display: table;
margin:20px auto;
font-size: 100px;
letter-spacing: var(--s);
font-family: monospace;
color: #fff;
background:
repeating-linear-gradient(to right, var(--c) 0 calc(1ch + var(--s) - var(--b)), transparent 0 calc(1ch + var(--s)))
0 0/calc(100% - var(--s)/2 - 1px) 100% no-repeat;
padding-left: calc((var(--s) - var(--b))/2);
transform:translateX(calc(var(--s)/3)); /* rectify the centring */
animation: c 1s infinite linear alternate;
animation-name: c1 ,c2 ,c3 ,c4 ,c5 ,c6 ,c7;
animation-duration:0.10s,0.05s,0.02s,0.12s,0.13s,0.14s,0.08s;
animation-play-state: running;
}
.box::before {
content:
counter(c1,upper-alpha)
counter(c2,upper-alpha)
counter(c3,upper-alpha)
counter(c4,upper-alpha)
counter(c5,upper-alpha)
counter(c6,upper-alpha)
counter(c7,upper-alpha)
}
@keyframes c1{to{--c1:26}}
@keyframes c2{to{--c2:26}}
@keyframes c3{to{--c3:26}}
@keyframes c4{to{--c4:26}}
@keyframes c5{to{--c5:26}}
@keyframes c6{to{--c6:26}}
@keyframes c7{to{--c7:26}}
input {opacity: 0.001}
input:checked + label {
animation-play-state: paused;
}