A living energy sphere hanging in a deep star field: volumetric plasma with a white-hot centre, a fresnel rim, a corona with rays and flares, parallax stars and a shock wave on click.

  • shader
  • webgl
  • raymarching
  • plasma
  • sphere
  • stars
  • background
  • hero
  • interactive
Preset

Installation

Pro — coming soon

The source and installation instructions for this item ship with Kagadmodyaa Pro.

Usage

Use it like any other component. Choose a theme with preset; any prop you pass as well overrides the preset.

import { useRef } from 'react'
import { PlasmaCore, type PlasmaCoreHandle } from '@/components/effects/plasma-core/plasma-core'

export function Hero() {
  const core = useRef<PlasmaCoreHandle>(null)
  return (
    <section className="relative h-[640px] overflow-hidden">
      {/* fills its parent; coreX / coreY / coreSize put the core beside the headline */}
      <PlasmaCore ref={core} preset="Ion" coreX={0.72} coreY={0.5} energy={0.8} className="absolute inset-0" />
      <div className="relative z-10 max-w-md p-12">
        <h1>Run on pure energy.</h1>
        <button onClick={() => core.current?.pulse()}>Ignite the core</button>
      </div>
    </section>
  )
}

// Presets: Solaris, Ion, Nebula, Verdant Reactor, Eclipse (the one made for light pages).
// Bind `energy` to scroll or a loading state; it eases, so you can set it every frame.
// The stage above is <PlasmaCoreShowcase />, also exported, if you want the same hero composition.
<PlasmaCore preset="Ion" energy={0.75} />

Presets

  • Solaris
  • Ion
  • Nebula
  • Verdant Reactor
  • Eclipse

Props

NameTypeDefaultDescription
preset'Solaris' | 'Ion' | 'Nebula' | 'Verdant Reactor' | 'Eclipse'none (the defaults below)A named theme. Any prop you pass as well overrides the preset’s value.
energynumber0.75How alive the core is: scales brightness, speed, turbulence, flares and the corona. Bind it to scroll or a loading state. Range 0 to 1.
coreSizenumber0.46Diameter of the core as a fraction of the shorter side of the box. Range 0.2 to 0.9.
turbulencenumber0.8How violently the plasma is stirred. Range 0 to 1.5.
filamentDetailnumber0.6How fine and sharp the filaments are. Range 0 to 1.
speednumber1Animation speed. 0 freezes everything. Range 0 to 2.5.
coreXnumber0.5Horizontal position of the core: 0 is the left edge, 1 the right edge. On the stage above it shifts the core from its designed spot. Range 0 to 1.
coreYnumber0.5Vertical position of the core: 0 is the top edge, 1 the bottom edge. On the stage above it shifts the core from its designed spot. Range 0 to 1.
coronaSizenumber1Reach of the halo and the flares. Range 0.3 to 1.8.
coronaIntensitynumber1Brightness of the halo, rays and flares. Range 0 to 2.
raysnumber0.6Soft rays streaming off the core. Range 0 to 1.
flaresnumber0.7How often flares lick off the surface. Range 0 to 1.
bloomnumber0.6Lens bloom: a veil of light around the core and a faint horizontal streak. Range 0 to 1.5.
starDensitynumber0.6How many stars hang in the parallax field. Range 0 to 1.
twinklenumber0.6How much stars twinkle and glint. Range 0 to 1.
nebulanumber0.5Amount of faint nebula dust. Range 0 to 1.
orbitRingnumber0.5Brightness of the tilted ring of particles around the core. 0 hides it. Range 0 to 1.
coreColorstring'#fff3d1'The hot centre; it is overexposed toward white. A hex colour.
midColorstring'#ffae3d'The plasma body. A hex colour.
rimColorstring'#ff4f1c'The rim, the ends of the filaments and the far corona. A hex colour.
nebulaColorstring'#7d3216'The nebula dust and some of the coloured stars. A hex colour.
backgroundstring'#060506'Colour of space. A light colour switches to the ink rendering made for light pages. A hex colour.
pointerPullnumber0.6How strongly the pointer leans the core and streams its filaments and flares toward it. 0 ignores the pointer. Range 0 to 1.
pulseOnClickbooleantrueA click sends a shock wave through the corona and the stars. Call pulse() on a ref to do it from code.
grainnumber0.35Amount of film grain. Range 0 to 1.
seednumber0A different, repeatable arrangement of filaments and flares. Range 0 to 40.
classNamestring—Extra class on the root element. The effect fills its parent: give the parent a height.
styleCSSProperties—Inline style on the root element.

Behaviour

  • Move the pointer near the core: it leans toward you, its hot spot follows, the filaments stream in your direction and the corona and the first two flares reach for the cursor. Set pointerPull to 0 to ignore the pointer.
  • A click or tap sends a shock wave through the corona and the stars: a ring of light races outward, bends the star field as it passes and the core flashes. Call pulse() on a ref (pulse(1.5) for a stronger one) to trigger it from your own button or a scroll position; pulseOnClick turns the click off.
  • energy (0 to 1) scales how alive the core is: at 0 it smoulders, dim and slow with almost no flares; at 1 it burns bright with a wide corona and frequent flares. It eases to new values, so you can bind it to scroll progress or a loading state.
  • The effect fills its parent and keeps the core at coreX, coreY and coreSize, so it can sit beside a headline. The stars, dust and corona use the whole box.
  • The Eclipse preset is a black disc with a bright rim and is rendered as ink on a light page. Any light background colour switches the same rendering on.
  • It pauses off screen and in a background tab, lowers its resolution automatically if frames run slow, and draws one composed still frame under prefers-reduced-motion. Without WebGL, and before the first frame, you see a CSS poster in the same colours.

See all effects