Black of White

Fork

Original: https://x.com/okazz_/status/2116556309969649962

Code

@grid: 13 / 600px / hsl(0 0% $(100 - floor(@ts/3)%2*100)%);

--a: $(mod(@ts/3 + (x+y)%2, 2)*π);
--ax, --ay, --az: sin(a)*sin(a/4), cos(a), sin(a)*cos(a/4);
--len: $(hypot(ax, ay) + az);
--k: $(az/len);

opacity: $(a < π);
scale: 1 $len;
rotate: $(@p([0-3])*π/2 - atan2(ax, ay))rad;
border-radius: 50% / $(50%*k);
background: @match((x+y)%2, #fff, #000);

&::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: @p(#2d55cb, #f8cc06, #6acee4, #d7263d);
  scale: 1 $k;
  transform-origin: bottom;
}