Plasma Core
NewProA 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
SolarisIonNebulaVerdant ReactorEclipse
Props
| Name | Type | Default | Description |
|---|---|---|---|
| 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. |
| energy | number | 0.75 | How alive the core is: scales brightness, speed, turbulence, flares and the corona. Bind it to scroll or a loading state. Range 0 to 1. |
| coreSize | number | 0.46 | Diameter of the core as a fraction of the shorter side of the box. Range 0.2 to 0.9. |
| turbulence | number | 0.8 | How violently the plasma is stirred. Range 0 to 1.5. |
| filamentDetail | number | 0.6 | How fine and sharp the filaments are. Range 0 to 1. |
| speed | number | 1 | Animation speed. 0 freezes everything. Range 0 to 2.5. |
| coreX | number | 0.5 | Horizontal 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. |
| coreY | number | 0.5 | Vertical 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. |
| coronaSize | number | 1 | Reach of the halo and the flares. Range 0.3 to 1.8. |
| coronaIntensity | number | 1 | Brightness of the halo, rays and flares. Range 0 to 2. |
| rays | number | 0.6 | Soft rays streaming off the core. Range 0 to 1. |
| flares | number | 0.7 | How often flares lick off the surface. Range 0 to 1. |
| bloom | number | 0.6 | Lens bloom: a veil of light around the core and a faint horizontal streak. Range 0 to 1.5. |
| starDensity | number | 0.6 | How many stars hang in the parallax field. Range 0 to 1. |
| twinkle | number | 0.6 | How much stars twinkle and glint. Range 0 to 1. |
| nebula | number | 0.5 | Amount of faint nebula dust. Range 0 to 1. |
| orbitRing | number | 0.5 | Brightness of the tilted ring of particles around the core. 0 hides it. Range 0 to 1. |
| coreColor | string | '#fff3d1' | The hot centre; it is overexposed toward white. A hex colour. |
| midColor | string | '#ffae3d' | The plasma body. A hex colour. |
| rimColor | string | '#ff4f1c' | The rim, the ends of the filaments and the far corona. A hex colour. |
| nebulaColor | string | '#7d3216' | The nebula dust and some of the coloured stars. A hex colour. |
| background | string | '#060506' | Colour of space. A light colour switches to the ink rendering made for light pages. A hex colour. |
| pointerPull | number | 0.6 | How strongly the pointer leans the core and streams its filaments and flares toward it. 0 ignores the pointer. Range 0 to 1. |
| pulseOnClick | boolean | true | A click sends a shock wave through the corona and the stars. Call pulse() on a ref to do it from code. |
| grain | number | 0.35 | Amount of film grain. Range 0 to 1. |
| seed | number | 0 | A different, repeatable arrangement of filaments and flares. Range 0 to 40. |
| className | string | — | Extra class on the root element. The effect fills its parent: give the parent a height. |
| style | CSSProperties | — | 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.