Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                - var total = 360 * 3

.center(style=`--total: ${total}`)
  - var i = total;
  while i--
    .particle(style=`--index: ${total - i}`)
              
            
!

CSS

              
                /* Look, no Sass */

.particle {
  /* Starting values */
  --angle: (5 * var(--index));
  --radius: 30;
  --x: calc(sin(var(--angle)) * var(--radius) * 1vmin);
  --y: calc(cos(var(--angle)) * var(--radius) * 1vmin);

  /* Ending values */
  /* 
  Had to move these outside the @keyframe and rename them 
  because Chrome was being weird 
  Bonusly, performance seems much better 
  */
  --angle2: calc(var(--index) * 1turn / var(--total));
  --x2: calc(sin(var(--angle2)) * var(--radius) * 1vmin);
  --y2: calc(cos(var(--angle2)) * var(--radius) * 1vmin);

  --size: 5;
  --speed: 3s;
  --delay: calc(var(--index) * var(--speed) / var(--total) * 4);

  --hue-angle: 10;
  --hue-range: 60;
  --hue-start: 20;

  /* Animation */
  animation: animation var(--speed) ease-out infinite alternate var(--delay);
  transform: translate3d(var(--x), var(--y), 0);
  opacity: 0;

  /* Particle styling */
  border-radius: 50%;
  background: currentColor;
  color: oklch(75% 0.3
      calc(
        sin(var(--hue-angle) * var(--index)) 
        * var(--hue-range) 
        + var(--hue-start)
      )
  );
  position: absolute;
  width: calc(var(--size) * 0.1vmin);
  height: calc(var(--size) * 0.1vmin);
  contain: strict; /* Does this help or is translate3d already doing it*/
}

@keyframes animation {
  100% {
    transform: translate3d(var(--x2), var(--y2), 0);
    opacity: 1;
  }
}

/* Pen styling, ignore */
body {
  background: #000;
  display: flex;
  min-height: 100vh;
  justify-content: center;
  align-content: center;
  align-items: center;
  overflow: hidden;
}

              
            
!

JS

              
                
              
            
!
999px

Console