Getting Started
FluxFX ships with zero runtime dependencies and builds three targets: ESM/CJS core, React bindings, and a self-booting IIFE CDN bundle.
Installation
npm • bash
npm install @votax572002/fluxfx For React projects, React >=18.0.0 is an optional peer dependency.
Package Exports
| Entry Point | Bundle Output | Purpose |
|---|---|---|
@votax572002/fluxfx | dist/index.js / .cjs | Core FluxFX engine with all 8 built-in effects registered. |
@votax572002/fluxfx/react | dist/react.js / .cjs | useFX hook + <Aurora/>, <LiquidMetal/>, <Fluid/>, <Ink/>, <Aetheria/>, <Prism3D/>, <TiltCard/>, <Magnetic/> (includes 'use client';). |
dist/fluxfx.min.js | IIFE (FluxFXCDN) | Script-tag CDN bundle; automatically calls FluxFX.init() on DOM ready. |
Your First Effect
main.ts • ts
import { FluxFX } from '@votax572002/fluxfx';
// Option A: Auto-discover all [data-fx] elements in the document
FluxFX.init();
// Option B: Mount imperatively on a specific HTMLElement
const hero = document.querySelector('#hero') as HTMLElement;
const destroy = FluxFX.apply(hero, 'prism-3d', {
shape: 'torus',
quality: 'high',
colors: ['#6366f1', '#06b6d4', '#f472b6'],
});
// Clean up when unmounting
// destroy(); Container & Stacking Rules
- Give the container explicit height: WebGL canvases size themselves to their container's bounding box. Add
min-height(e.g.,60vh) or fixed dimensions so the canvas isn't0pxtall. - Automatic stacking context:
WebGLQuadsetsisolation: isolate(andposition: relativeifstatic) on the target element, then prepends the canvas atz-index: -1(orz-index: 10whenlayer="overlay"). - Keep interactive children above: Child content renders cleanly above background canvases; nested interactive containers automatically coordinate via
data-fluxfx-interactive="true".