# square

⬅️back

<div class="loader">
    <div class="square"></div>
    <div class="square"></div>
    <div class="square"></div>
    <div class="square"></div>
    <div class="square"></div>
    <div class="square"></div>
    <div class="square"></div>
    <div class="square"></div>
    <div class="square"></div>
    <div class="square"></div>
    <div class="square"></div>
    <div class="square"></div>
    <div class="square"></div>
    <div class="square"></div>
    <div class="square"></div>
    <div class="square"></div>
</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
body {
  display: flex;
  height: 100vh;
  justify-content: center;
  align-items: center;
  background: #b3e5fc;
}

.loader {
  width: 10em;
  height: 10em;
  display: flex;
  flex-wrap: wrap;

  .square {
    width: 25%;
    height: 25%;
    background: #ff5252;
    animation: zoom 1.4s ease-in-out infinite;

    // stagger from left-bottom to right-top
    // order: 13 - 9,14 - 5,10,15 - 1,6,11,16 - 2,7,12 - 3,8 - 4
    &:nth-child(13) {
      animation-delay: 0s;
    }

    &:nth-child(9),
    &:nth-child(14) {
      animation-delay: 0.1s;
    }

    &:nth-child(5),
    &:nth-child(10),
    &:nth-child(15) {
      animation-delay: 0.2s;
    }

    &:nth-child(1),
    &:nth-child(6),
    &:nth-child(11),
    &:nth-child(16) {
      animation-delay: 0.3s;
    }

    &:nth-child(2),
    &:nth-child(7),
    &:nth-child(12) {
      animation-delay: 0.4s;
    }

    &:nth-child(3),
    &:nth-child(8) {
      animation-delay: 0.4s;
    }

    &:nth-child(4) {
      animation-delay: 0.5s;
    }
  }
}

@keyframes zoom {
  35% {
    transform: scale(0);
  }

  0%,
  70%,
  to {
    transform: scale(1);
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72