Skip to content
Halorav0.1.0

Behaviors

Particles

A quiet field of light points. Optional, and tuned to stay out of the way.

Usage#

HTML
<canvas class="ha-particles" aria-hidden="true"></canvas>
JavaScript
import { startParticles } from '@originlabsbr/halora/particles';

const stop = startParticles({ canvas: '.ha-particles' });

The landing page of this site runs it. It is generalized from the portfolio field.

What it does for performance and accessibility#

  • Starts after first paint, 400ms later, through requestIdleCallback, so it never competes with the largest paint.
  • Particle count scales with the viewport area, clamped to 24 to 160.
  • The device pixel ratio is capped at 2 and drawing is limited to 30 frames per second.
  • It pauses when the tab is hidden.
  • Under reduced motion or the pause switch it draws one still frame and stops.
  • It follows data-theme and data-brand on the root and re-tones itself.
  • The canvas is aria-hidden and has pointer-events: none.

API#

NameSignatureDescription
startParticles({ canvas?, palettes? }) => destroyStart the field. Palettes are keyed by brand and theme.
particleCount(width, height) => numberOne per 9000 square pixels, clamped to 24..160.
createField, advance, resizeField, retonepure functionsThe simulation, testable without a canvas.
depthFade(z) => numberFade in when far, out when near.
PALETTES{ origin, gabarito }rgb tones and a max alpha per theme.

Edit this page on GitHub

Type to search.