A React component that renders an interactive 3D tubes background using Three.js, with smooth animations powered by Framer Motion and GSAP.
✨ Three.js 3D Effect — Liquid shader background with animated monolyth (icosahedron)
🎨 Interactive — Cursor tracking and click-to-randomize colors
⚡ Optimized — Loaded via CDN, no large bundled dependencies
🎭 Framer Motion — Smooth reveal animations and magnetic CTA
📱 Responsive — Works on all screen sizes
- React 18 + TypeScript
- Next.js 14 (App Router)
- Tailwind CSS (styling)
- Framer Motion (animations)
- Three.js (via CDN) — threejs-components library
npm install
# or
yarn installnpx tailwindcss init -pThis creates tailwind.config.js and postcss.config.js.
In tsconfig.json, ensure you have:
{
"compilerOptions": {
"paths": {
"@/*": ["./*"]
}
}
}npm run dev
# or
yarn devVisit http://localhost:3000 to see the component in action.
import { TubesBackground } from '@/components/ui/neon-flow';
export default function Page() {
return (
<TubesBackground>
<div className="flex items-center justify-center h-full">
<h1 className="text-6xl text-white">Your Content Here</h1>
</div>
</TubesBackground>
);
}| Prop | Type | Default | Description |
|---|---|---|---|
children |
React.ReactNode |
undefined |
Content to render above the background |
className |
string |
undefined |
Additional CSS classes for the container |
enableClickInteraction |
boolean |
true |
Allow color randomization on click |
- Canvas Setup — The component creates a canvas element for Three.js
- Shader Loading — Loads
threejs-componentslibrary from CDN - 3D Rendering — Renders liquid shader background + animated icosahedron
- Interaction — Tracks cursor movement and handles click events
- Overlay — Content is rendered in a
z-10overlay above the 3D effect
Edit neon-flow.tsx, update the TubesCursor configuration:
const app = TubesCursor(canvasRef.current, {
tubes: {
colors: ["#your", "#custom", "#colors"],
lights: {
intensity: 200,
colors: ["#light1", "#light2", "#light3", "#light4"]
}
}
});Modify the shader parameters in the CDN library configuration (limited by external library).
- Chrome 90+
- Firefox 88+
- Safari 15+
- Edge 90+
Requires WebGL 2.0 support.
neon-flow/
├── app/
│ ├── globals.css # Global Tailwind styles
│ ├── layout.tsx # Root layout
│ └── page.tsx # Demo page
├── components/
│ └── ui/
│ └── neon-flow.tsx # Main component
├── lib/
│ └── utils.ts # cn() utility function
├── package.json
├── tsconfig.json
├── tailwind.config.js
├── next.config.js
├── postcss.config.js
└── README.md
- The Three.js library is loaded dynamically from CDN (
threejs-components@0.0.19) - Canvas resizes automatically on window resize
- Uses
pointer-events-noneon canvas to allow interaction with overlay content - TypeScript support is fully configured
MIT
Built for Vlad Yasko's Skill Library 🚀