پیشنمایش زنده
کد HTML
<div class="progress-container">
<div class="progress-grid">
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
</div>
</div>
کد CSS
.progress-container {
width: 90%;
max-width: 400px;
margin: 20px auto;
padding: 16px;
border-radius: 16px;
background: transparent;
position: relative;
}
.progress-grid {
display: grid;
grid-template-columns: repeat(25, 1fr);
grid-template-rows: repeat(4, 1fr);
gap: 4px;
perspective: 1200px;
}
.pixel {
position: relative;
width: 100%;
padding-top: 100%;
border-radius: 50%;
transform-style: preserve-3d;
transform-origin: center;
background: #111;
box-shadow:
0 0 2px #4caf50,
0 0 5px #4caf50,
0 0 10px #4caf50;
animation-name: fill-animation;
animation-duration: 10s;
animation-timing-function: linear;
animation-iteration-count: 2;
animation-fill-mode: forwards;
opacity: 0;
transform: translateZ(0);
will-change: transform, opacity;
}
@keyframes fill-animation {
0%,
1% {
opacity: 0;
transform: rotateY(180deg) scale(0.8);
background: #111;
box-shadow:
0 0 2px #000,
0 0 5px #000,
0 0 10px #000;
}
10% {
opacity: 1;
transform: rotateY(90deg) scale(1);
background: #4caf50;
box-shadow:
0 0 5px #4caf50,
0 0 15px #4caf50,
0 0 30px #4caf50;
}
50% {
transform: rotateY(0deg) scale(1.2);
background: #4caf50;
box-shadow:
0 0 12px #4caf50,
0 0 24px #4caf50,
0 0 40px #4caf50;
}
99% {
transform: rotateY(0deg) scale(1.1);
background: #fdd835;
box-shadow:
0 0 8px #fdd835,
0 0 25px #fdd835,
0 0 60px #fdd835;
opacity: 1;
}
100% {
background: #ff2f92;
box-shadow:
0 0 15px #ff2f92,
0 0 40px #ff2f92,
0 0 80px #ff2f92;
transform: rotateY(720deg) scale(1.5);
opacity: 1;
}
}
.pixel::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
width: 150%;
height: 150%;
background: radial-gradient(
circle at 50% 50%,
rgba(255, 255, 255, 0.4) 0%,
rgba(255, 255, 255, 0) 60%
);
transform: translate(-50%, -50%) rotate(45deg);
mix-blend-mode: color-dodge;
opacity: 0;
transition: opacity 0.6s ease-in;
}
.pixel:hover::after,
.pixel:hover {
opacity: 1;
}
/* Your existing staggered delays */
.pixel:nth-child(1) {
animation-delay: 0s;
}
.pixel:nth-child(26) {
animation-delay: 0.1s;
}
.pixel:nth-child(51) {
animation-delay: 0.2s;
}
.pixel:nth-child(76) {
animation-delay: 0.3s;
}
.pixel:nth-child(77) {
animation-delay: 0.4s;
}
.pixel:nth-child(52) {
animation-delay: 0.5s;
}
.pixel:nth-child(27) {
animation-delay: 0.6s;
}
.pixel:nth-child(2) {
animation-delay: 0.7s;
}
.pixel:nth-child(3) {
animation-delay: 0.8s;
}
.pixel:nth-child(28) {
animation-delay: 0.9s;
}
.pixel:nth-child(53) {
animation-delay: 1s;
}
.pixel:nth-child(78) {
animation-delay: 1.1s;
}
.pixel:nth-child(79) {
animation-delay: 1.2s;
}
.pixel:nth-child(54) {
animation-delay: 1.3s;
}
.pixel:nth-child(29) {
animation-delay: 1.4s;
}
.pixel:nth-child(4) {
animation-delay: 1.5s;
}
.pixel:nth-child(5) {
animation-delay: 1.6s;
}
.pixel:nth-child(30) {
animation-delay: 1.7s;
}
.pixel:nth-child(55) {
animation-delay: 1.8s;
}
.pixel:nth-child(80) {
animation-delay: 1.9s;
}
.pixel:nth-child(81) {
animation-delay: 2s;
}
.pixel:nth-child(56) {
animation-delay: 2.1s;
}
.pixel:nth-child(31) {
animation-delay: 2.2s;
}
.pixel:nth-child(6) {
animation-delay: 2.3s;
}
.pixel:nth-child(7) {
animation-delay: 2.4s;
}
.pixel:nth-child(32) {
animation-delay: 2.5s;
}
.pixel:nth-child(57) {
animation-delay: 2.6s;
}
.pixel:nth-child(82) {
animation-delay: 2.7s;
}
.pixel:nth-child(83) {
animation-delay: 2.8s;
}
.pixel:nth-child(58) {
animation-delay: 2.9s;
}
.pixel:nth-child(33) {
animation-delay: 3s;
}
.pixel:nth-child(8) {
animation-delay: 3.1s;
}
.pixel:nth-child(9) {
animation-delay: 3.2s;
}
.pixel:nth-child(34) {
animation-delay: 3.3s;
}
.pixel:nth-child(59) {
animation-delay: 3.4s;
}
.pixel:nth-child(84) {
animation-delay: 3.5s;
}
.pixel:nth-child(85) {
animation-delay: 3.6s;
}
.pixel:nth-child(60) {
animation-delay: 3.7s;
}
.pixel:nth-child(35) {
animation-delay: 3.8s;
}
.pixel:nth-child(10) {
animation-delay: 3.9s;
}
.pixel:nth-child(11) {
animation-delay: 4s;
}
.pixel:nth-child(36) {
animation-delay: 4.1s;
}
.pixel:nth-child(61) {
animation-delay: 4.2s;
}
.pixel:nth-child(86) {
animation-delay: 4.3s;
}
.pixel:nth-child(87) {
animation-delay: 4.4s;
}
.pixel:nth-child(62) {
animation-delay: 4.5s;
}
.pixel:nth-child(37) {
animation-delay: 4.6s;
}
.pixel:nth-child(12) {
animation-delay: 4.7s;
}
.pixel:nth-child(13) {
animation-delay: 4.8s;
}
.pixel:nth-child(38) {
animation-delay: 4.9s;
}
.pixel:nth-child(63) {
animation-delay: 5s;
}
.pixel:nth-child(88) {
animation-delay: 5.1s;
}
.pixel:nth-child(89) {
animation-delay: 5.2s;
}
.pixel:nth-child(64) {
animation-delay: 5.3s;
}
.pixel:nth-child(39) {
animation-delay: 5.4s;
}
.pixel:nth-child(14) {
animation-delay: 5.5s;
}
.pixel:nth-child(15) {
animation-delay: 5.6s;
}
.pixel:nth-child(40) {
animation-delay: 5.7s;
}
.pixel:nth-child(65) {
animation-delay: 5.8s;
}
.pixel:nth-child(90) {
animation-delay: 5.9s;
}
.pixel:nth-child(91) {
animation-delay: 6s;
}
.pixel:nth-child(66) {
animation-delay: 6.1s;
}
.pixel:nth-child(41) {
animation-delay: 6.2s;
}
.pixel:nth-child(16) {
animation-delay: 6.3s;
}
.pixel:nth-child(17) {
animation-delay: 6.4s;
}
.pixel:nth-child(42) {
animation-delay: 6.5s;
}
.pixel:nth-child(67) {
animation-delay: 6.6s;
}
.pixel:nth-child(92) {
animation-delay: 6.7s;
}
.pixel:nth-child(93) {
animation-delay: 6.8s;
}
.pixel:nth-child(68) {
animation-delay: 6.9s;
}
.pixel:nth-child(43) {
animation-delay: 7s;
}
.pixel:nth-child(18) {
animation-delay: 7.1s;
}
.pixel:nth-child(19) {
animation-delay: 7.2s;
}
.pixel:nth-child(44) {
animation-delay: 7.3s;
}
.pixel:nth-child(69) {
animation-delay: 7.4s;
}
.pixel:nth-child(94) {
animation-delay: 7.5s;
}
.pixel:nth-child(95) {
animation-delay: 7.6s;
}
.pixel:nth-child(70) {
animation-delay: 7.7s;
}
.pixel:nth-child(45) {
animation-delay: 7.8s;
}
.pixel:nth-child(20) {
animation-delay: 7.9s;
}
.pixel:nth-child(21) {
animation-delay: 8s;
}
.pixel:nth-child(46) {
animation-delay: 8.1s;
}
.pixel:nth-child(71) {
animation-delay: 8.2s;
}
.pixel:nth-child(96) {
animation-delay: 8.3s;
}
.pixel:nth-child(97) {
animation-delay: 8.4s;
}
.pixel:nth-child(72) {
animation-delay: 8.5s;
}
.pixel:nth-child(47) {
animation-delay: 8.6s;
}
.pixel:nth-child(22) {
animation-delay: 8.7s;
}
.pixel:nth-child(23) {
animation-delay: 8.8s;
}
.pixel:nth-child(48) {
animation-delay: 8.9s;
}
.pixel:nth-child(73) {
animation-delay: 9s;
}
.pixel:nth-child(98) {
animation-delay: 9.1s;
}
.pixel:nth-child(99) {
animation-delay: 9.2s;
}
.pixel:nth-child(74) {
animation-delay: 9.3s;
}
.pixel:nth-child(49) {
animation-delay: 9.4s;
}
.pixel:nth-child(24) {
animation-delay: 9.5s;
}
.pixel:nth-child(25) {
animation-delay: 9.6s;
}
.pixel:nth-child(50) {
animation-delay: 9.7s;
}
.pixel:nth-child(75) {
animation-delay: 9.8s;
}
.pixel:nth-child(100) {
animation-delay: 9.9s;
}
@media (max-width: 600px) {
.pixel {
animation-name: fill-animation-mobile;
animation-duration: 8s;
animation-timing-function: linear;
animation-iteration-count: 1;
animation-fill-mode: forwards;
}
@keyframes fill-animation-mobile {
0%,
1% {
opacity: 0;
transform: rotateY(90deg) scale(0.8);
background: #111;
box-shadow: none;
}
20% {
opacity: 1;
transform: rotateY(45deg) scale(0.9);
background: #4caf50;
box-shadow: 0 0 8px #4caf50;
}
50% {
transform: rotateY(0deg) scale(1.1);
background: #fdd835;
box-shadow: 0 0 12px #fdd835;
}
80% {
background: #fdd835;
transform: rotateY(0deg) scale(1.2);
box-shadow: 0 0 15px #fdd835;
}
100% {
background: #ff2f92;
box-shadow: 0 0 20px #ff2f92;
transform: rotateY(180deg) scale(1.3);
opacity: 1;
}
}
}
@media screen and (max-width: 468px) {
.progress-container {
width: 75%;
}
}