- var i = 0;
- var num = 199;
input(type="checkbox" id="bloom")
label.flower.select-2(style="--num: "+num for="bloom")
  while i < num
   .pedal(style="--i: "+i+"; --iHex: "+Math.floor(i * 255/num))
   - i++;
View Compiled
body {
  --golden: 2.39996322972865332;
  --bg: #1a1b1f;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: center;
}
#bloom {
  position: absolute;
  visibility: hidden;
  pointer-events: none;
}
.flower {
  --size: 80vmin;
  --multiplier: 1;
  width: var(--size);
  height: var(--size);
  position: relative;
  border-radius: var(--size);
  transform: rotate(-90deg);
}
.pedal {
  --iPercent: calc(var(--i) / var(--num));
  --iPercentInv: calc(1 - var(--iPercent));
  --pSize: calc(var(--size) * var(--iPercent) * 0.2 + 3%);
  --angle: calc(var(--i) * var(--golden) * var(--multiplier) * 1rad);
  --x: calc(var(--iPercent) * var(--size) * 0.5);
  --opacity: calc(var(--iPercent) * 0.5);
  --hue: calc(var(--iHex) * 1);
  --color1: hsla(var(--hue), 100%, 50%, 1);
  --color2: hsla(calc(var(--hue) + 240), 100%, 50%, 1);
  --height: calc(var(--pSize) * var(--iPercentInv) + 0.2%);
  --z: calc(var(--num) - var(--i));
  width: var(--pSize);
  height: var(--height);
  z-index: var(--z);
  border-radius: 999px;
  position: absolute;
  left: 0; right: 0; top: 0; bottom: 0;
  margin: auto;
  background: linear-gradient(90deg, var(--color1), var(--color2));
  box-shadow: 0 0 20px var(--color2);
  transform: rotate(calc(var(--angle) * 1.0015)) translate(0, 0) scale(calc(var(--iPercentInv) * 0.3));
  animation: openThenRotate 800s infinite calc(var(--iPercent) * 0.1s) normal ease-in-out forwards;
}
@for $i from 0 through 20 {
  @for $j from 0 through $i {
    .select-#{$i} .pedal:nth-child(#{$i}n + #{$j}) {
      --hue: calc(var(--iHex) + #{17 * $j});
    }
  }
}
.pedal:first-child {
    background: var(--color2);
    --meSize: calc(var(--pSize) * 0.93);
    width: var(--meSize);
    height: var(--meSize);
    opacity: 0.7;
}

@keyframes openThenRotate{
  from {
    transform: rotate(calc(var(--angle) * 1.0005)) translate(0, 0) scale(calc(var(--iPercentInv) * 0.3));
    animation-timing-function: ease-in-out;
  }
  0.3% {
    transform: rotate(calc(var(--angle) * 1)) translate(calc(var(--x) * 1), 0) scale(1.1);
    animation-timing-function: ease-in-out;
  }
  50.4% {
    transform: rotate(calc(var(--angle) * 0)) translate(calc(var(--x) * 1), 0) scale(1);
  }
  to {
    transform: rotate(calc(var(--angle) * 1)) translate(calc(var(--x) * 1), 0) scale(1);
  }
}
View Compiled
// No script for you!

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.