Particles

WebGL particle field with mouse interaction powered by OGL

Preview
Source Code

Overview

Particles renders a 3D point cloud using OGL with configurable count, spread, color palette, and mouse interaction. Particles animate with sine-based displacement, optional rotation, and support alpha blending for a soft glow effect.

Features

  • WebGL powered — hardware-accelerated 3D particle rendering via OGL
  • Mouse interaction — particles shift based on cursor position
  • Configurable palette — pass any array of hex colors
  • Size randomness — particles vary in size based on distance and random seed
  • Rotation animation — gentle auto-rotation with disable option

Usage

import Particles from '@/components/particles'

<div className="h-[400px]">
  <Particles
    particleCount={300}
    particleColors={['#ffffff', '#00d2ff', '#7cff67']}
    moveParticlesOnHover
    alphaParticles
    speed={0.1}
  />
</div>

Props

PropTypeDefaultDescription
particleCountnumber200Total number of particles
particleSpreadnumber10Spread radius of the particle cloud
speednumber0.1Animation speed multiplier
particleColorsstring[]['#ffffff', '#ffffff', '#ffffff']Array of hex colors randomly assigned to particles
moveParticlesOnHoverbooleanfalseEnable mouse-driven particle displacement
particleHoverFactornumber1Multiplier for mouse displacement strength
alphaParticlesbooleanfalseEnable soft alpha-blended particles
particleBaseSizenumber100Base size of each particle point
sizeRandomnessnumber1Amount of random size variation
cameraDistancenumber20Camera distance from the particle cloud
disableRotationbooleanfalseDisable automatic rotation animation
pixelRationumber1Device pixel ratio for rendering
classNamestringAdditional CSS classes for the container

On this page