λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°
CSS

[CSS] μ• λ‹ˆλ©”μ΄μ…˜04 : μ›¨μ΄λΈŒ~~μ›¨μ΄λΈŒ~~

by _토맀토 2022. 9. 19.
728x90

CSS : μ• λ‹ˆλ©”λ‹ˆμ…˜ λ§Œλ“€κΈ° : λ¬Όκ²° 웨~이뢀~~~ 🌊 🌊

이번 μ‹œκ°„μ—λŠ” CSS μ‹€μŠ΅μœΌλ‘œ 원듀이 ν›Œλž„λΌ ν•˜λŠ” λ“―ν•œ μ• λ‹ˆλ©”μ΄μ…˜μ„ λ§Œλ“€μ–΄λ³΄κ² μŠ΅λ‹ˆλ‹€. πŸ˜„
였늘 μ‹€μŠ΅μ˜ ν¬μΈνŠΈλŠ” 퍼그와 SCSS 그리고 λ°˜λ³΅λ¬Έμž…λ‹ˆλ‹€~!


#1. PUG

λ‹€μŒμ€ PUG μ½”λ“œμ™€ μ»΄νŒŒμΌν•œ HTML μ½”λ“œ μž…λ‹ˆλ‹€!

🐢 PUG

div.circle-wrap
  - for (var x =1; x <= 12; x++)
    div.row
      - for (var y = 1; y <= 12; y++)
        div.circle
πŸ’Ώ HTML 컴파일 ver
<div class="circle-wrap">
  <div class="row">
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
  </div>
  <div class="row">
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
  </div>
  <div class="row">
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
  </div>
  <div class="row">
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
  </div>
  <div class="row">
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
  </div>
  <div class="row">
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
  </div>
  <div class="row">
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
  </div>
  <div class="row">
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
  </div>
  <div class="row">
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
  </div>
  <div class="row">
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
  </div>
  <div class="row">
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
  </div>
  <div class="row">
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
  </div>
</div>

#2. SCSS

λ‹€μŒμ€ SCSS μ½”λ“œμ™€ μ»΄νŒŒμΌν•œ CSS μ½”λ“œ μž…λ‹ˆλ‹€!
였늘의 ν¬μΈνŠΈλŠ” mixinμž…λ‹ˆλ‹€. SCSSλ₯Ό μ‚¬μš©ν•  λ•Œ 주둜 μ‚¬μš©ν•˜λŠ” νŒ¨ν„΄μœΌλ‘œ μ½”λ“œλ₯Ό μž¬μ‚¬μš©ν•˜κΈ° μœ„ν•΄μ„œ λ§Œλ“€μ–΄μ§„ νŒ¨ν„΄μž…λ‹ˆλ‹€.

🧸 SCSS

@mixin center {
  display : flex;
  align-items: center;
  justify-content: center;
}
body {
  @include center;
  height: 100vh;
  background-image: linear-gradient(45deg, #00DBDE 0%, #FC00FF 100%);
}
.row {
  display: flex;
  .circle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin: 5px 10px;
    background: #fff;
    transform-origin : top center;
    animation : spin 1s linear infinite;
  }
  @keyframes spin {
    0% {transform : scale(1.1) rotate(0deg);}
    50% {transform : scale(0.2) rotate(180deg);}
    100% {transform : scale(1.1) rotate(360deg);}
  }
}
@for $i from 1 through 12 {
    .row:nth-child(#{$i}) .circle {animation-delay : 100ms * $i;}
}
πŸŽ€ CSS 컴파일 ver
body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background-image: linear-gradient(45deg, #00DBDE 0%, #FC00FF 100%);
}

.row {
  display: flex;
}
.row .circle {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin: 5px 10px;
  background: #fff;
  transform-origin: top center;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% {
    transform: scale(1.1) rotate(0deg);
  }
  50% {
    transform: scale(0.2) rotate(180deg);
  }
  100% {
    transform: scale(1.1) rotate(360deg);
  }
}

.row:nth-child(1) .circle {
  animation-delay: 100ms;
}

.row:nth-child(2) .circle {
  animation-delay: 200ms;
}

.row:nth-child(3) .circle {
  animation-delay: 300ms;
}

.row:nth-child(4) .circle {
  animation-delay: 400ms;
}

.row:nth-child(5) .circle {
  animation-delay: 500ms;
}

.row:nth-child(6) .circle {
  animation-delay: 600ms;
}

.row:nth-child(7) .circle {
  animation-delay: 700ms;
}

.row:nth-child(8) .circle {
  animation-delay: 800ms;
}

.row:nth-child(9) .circle {
  animation-delay: 900ms;
}

.row:nth-child(10) .circle {
  animation-delay: 1000ms;
}

.row:nth-child(11) .circle {
  animation-delay: 1100ms;
}

.row:nth-child(12) .circle {
  animation-delay: 1200ms;
}

728x90

λŒ“κΈ€


Lucky Charms Rainbow
js
html
css