Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Backgrounds

  • DotPattern
  • GridPattern
  • StripedPattern
  • Spotlight
  • FadeMask
  • RetroGrid
  • Ripple
  • Meteors
  • Aurora
  • Particles
  • FlickeringGrid
  • WavyBackground
  • Silk
  • Iridescence
  • Threads
  • Orb
  • LiquidChrome
  • Balatro
  • Ballpit
  • Beams
  • ColorBends
  • DarkVeil
  • Dither
  • DotField
  • EvilEye
  • FaultyTerminal
  • Ferrofluid
  • FloatingLines
  • Galaxy
  • GradientBlinds
  • Grainient
  • GridDistortion
  • GridMotion
  • GridScan
  • Hyperspeed
  • LetterGlitch
  • Lightfall
  • Lightning
  • LightPillar
  • LightRays
  • LineWaves
  • LiquidEther
  • PixelBlast
  • PixelSnow
  • Plasma
  • PlasmaWave
  • Prism
  • PrismaticBurst
  • Radar
  • RippleGrid
  • ShapeGrid
  • SideRays
  • SoftAurora

Overlay Effects

  • BorderBeam
  • ShineBorder
  • GlareHover
  • Lens
  • AnimatedBeam
  • OrbitingCircles
  • ProgressiveBlur
  • CardSpotlight
  • Reveal
  • Antigravity
  • BlobCursor
  • ClickSpark
  • Crosshair
  • ElectricBorder
  • GhostCursor
  • GradualBlur
  • ImageTrail
  • LaserFlow
  • MagicRings
  • Magnet
  • MagnetLines
  • MetaBalls
  • MetallicPaint
  • OrbitImages
  • PixelTrail
  • PixelTransition
  • Ribbons
  • ShapeBlur
  • SplashCursor
  • StarBorder
  • StickerPeel
  • TargetCursor
  • Cubes
  • Tilt
  • BorderGlow
  • GlassIcons
  • GlassSurface
  • Lanyard
  • ModelViewer
  • FluidGlass

Antigravity

antigravity

Pulls drifting particles into pointer-centered orbits before easing them back into place.

Usage

Basic usage

By default, short stick particles fill the container. Moving the mouse will suck nearby particles into the orbit around the cursor.

Move the mouse to absorb particles
tsx
<div
  className="relative h-64 overflow-hidden rounded-xl"
  style={{ background: "oklch(0.14 0.02 255)" }}
>
  <Antigravity className="absolute inset-0" />
</div>

Shape and Color

shape Optional bar / dot / square; color Accepts any CSS color or theme token.

Move the mouse to absorb particles
tsx
<Antigravity
  className="absolute inset-0"
  shape="dot"
  color="oklch(0.72 0.22 30)"
  count={320}
/>

Automatic patrol

autoAnimate Make the cursor stationary 2s and then the particles will cruise on their own, suitable for unattended large-screen display.

Move the mouse to absorb particles
tsx
<Antigravity
  className="absolute inset-0"
  autoAnimate
  rotationSpeed={0.4}
  shape="square"
  color="var(--color-chart-2)"
/>

Large magnetic field · Large ring

Turn up the magnetRadius / ringRadius / waveAmplitude for a more stretched, organic track.

Move the mouse to absorb particles
tsx
<Antigravity
  className="absolute inset-0"
  magnetRadius={200}
  ringRadius={90}
  waveAmplitude={18}
  color="var(--color-chart-4)"
/>

When to Use

Use it for a full particle backdrop whose particles gather around a nearby pointer, then ease back into place, such as a hero or display wall. This is a Canvas 2D attraction field. Use BlobCursor for a liquid pointer trail, ClickSpark for click bursts, or BorderBeam for a moving border highlight.

Import

ts
import { Antigravity } from "@hulianui/ui"

Props

NameTypeDefaultDescription
countnumber240Particle count; higher values cost more, so keep mobile usage at or below 200
magnetRadiusnumber130Attraction radius in pixels; particles inside this pointer range join the orbit
ringRadiusnumber56Orbital base radius (px)
waveSpeednumber0.4Speed of the radial wave traveling around the ring
waveAmplitudenumber10Ring-wave amplitude in pixels; larger values make the orbit rougher and more organic
particleSizenumber4Particle base size (px); dot=diameter / square=side length / bar=length
lerpSpeednumber0.12Target interpolation factor from 0 to 1; higher values track more tightly
colorstringvar(--color-chart-1)Particle color; accepts any CSS color and defaults to a theme-aware token
autoAnimatebooleanfalseStart an automatic pointer path after two seconds of inactivity
rotationSpeednumber0Angular speed of the entire ring in radians per second; 0 disables rotation
pulseSpeednumber3Scale-pulse speed while particles are attracted
shape"dot" | "square" | "bar""bar"Particle shape
classNamestring-Class name forwarded to the root canvas wrapper or fallback

Slots

SlotTypeDescription
fallbackReactNodeCustom static content for reduced motion or unavailable Canvas 2D

Usage Guidelines

  • This Canvas 2D client component needs a positioned parent with an explicit height. Use absolute inset-0 to fill it.
  • Token-valued color props need the --color- prefix. Canvas cannot resolve bare var(--chart-1); use var(--color-chart-1). See [[hulian-token-color-var-needs-color-prefix]].
  • count directly affects performance. Keep it at or below 200 on mobile and lower-end devices.
  • Reduced-motion and unavailable Canvas 2D environments render a static dot field; replace it through fallback if needed.

Related

BorderBeam · ShineBorder · GlareHover · Lens · AnimatedBeam · OrbitingCircles

Playground

Move the mouse to absorb particles
<div className="relative h-64 overflow-hidden rounded-xl"
     style={{ background: "oklch(0.14 0.02 255)" }}>
  <Antigravity
    className="absolute inset-0"
    count={240}
    magnetRadius={130}
    ringRadius={56}
    particleSize={4}
    shape="bar"
    autoAnimate={false}
  />
</div>
PreviousRevealDecorationNextBlobCursor

On this page

  • Usage
  • Documentation
    • When to Use
    • Import
    • Props
    • Slots
    • Usage Guidelines
    • Related
  • Playground