- var particles = 540
.chain
  - for (var i = 0; i < particles; ++i) {
  .segment
  - }
View Compiled
$particles: 540;
$loops: 6;

body {
  margin: 0;
  background-color: #000;
  height: 100vh;
  display: grid;
  align-content: center;
  overflow: hidden;
}

.chain {
  display: flex;
  flex-direction: row;
  position: absolute;
  inset: 25vh 0;
  justify-content: space-between;
}

.segment {
  height: 100%;
  position: relative;
  rotate: calc(var(--turnStep)*#{360/$particles*$loops}deg);
  display: flex;
  justify-content: center;
}

.segment::before {
  content: '';
  position: absolute;
  width: 5vmin;
  aspect-ratio: 1;
  border-radius: 50%;
  background-color: hsl(calc(var(--hue)*#{360/$particles}deg) 100% 50%);
}

@for $i from 1 through $particles/$loops {
  .segment:nth-child(#{$particles/$loops}n+#{$i}) {
    --turnStep: #{$i};
  }
}

@for $i from 1 through $particles {
  .segment:nth-child(#{$i}) {
    --hue: #{$i};
  }
}

View Compiled
/* A step-by-step guide of how to make this, with comments on each line of code, in a tutorial on my blog at:

https://dev.to/mackfitz/particles-spiral-patterns-in-css-part-i-2p9n

https://mackfitz.hashnode.dev/particles-spiral-patterns-in-css-part-i */

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.