Skip to content

Magnetic Sand API

MagneticSand

Extends Effect.

Factory Function

typescript
createMagneticSand(config?: MagneticSandConfig)

Methods

See Effect for the full method reference: mount(), start(), pause(), resume(), configure(), withFade(), and destroy().

The magnetic sand effect responds to mouse hover: particles within range align into eight radial spike formations around the cursor.


MagneticSandConfig

typescript
interface MagneticSandConfig {
    speed?: number;
    count?: number;
    color?: string;
    magnetStrength?: number;
    scale?: number;
}
PropertyTypeDefaultDescription
speednumber1Animation speed multiplier.
countnumber600Number of sand grains. Halved on small screens.
colorstring'#1a1a1a'Color of all sand grains.
magnetStrengthnumber1Strength of the magnetic attraction and spike formation.
scalenumber1Global scale factor for grain sizes and interaction radius.