import { Experiences3D } from "@/components/3d/experiences";
export default function Example() {
return (
<div style={{ height: 480 }}>
<Experiences3D
variant="fluid"
theme="light"
/>
</div>
);
}
Deps: three, @react-three/fiber, @react-three/drei, framer-motion
Installation
Install the runtime dependencies, then copy the component module (and the shared 3D core when the component uses WebGL).
npm install three @react-three/fiber @react-three/drei framer-motion
# Copy the component module
cp -r src/components/3d/experiences <your-project>/src/components/3d/experiencesDependencies: three, @react-three/fiber, @react-three/drei, framer-motion
Usage
Every category module exposes one typed component. Pick an implementation with variant and pass props grouped by concern.
import { Experiences3D } from "@/components/3d/experiences";
export default function Example() {
return (
<div style={{ height: 480 }}>
<Experiences3D
variant="fluid"
theme="light"
/>
</div>
);
}
React implementation
With every prop set explicitly. The complete, copyable source of src/components/3d/experiences/index.tsx is available in the playground’s Source tab.
import { Experiences3D } from "@/components/3d/experiences";
export default function Example() {
return (
<div style={{ height: 480 }}>
<Experiences3D
variant="fluid"
theme="amoled"
color="#7777ff"
viscosity={0.0001}
diffusion={0.00005}
intensity={1}
speed={1}
/>
</div>
);
}
Next.js implementation
This component is DOM based, but it is still code-split with next/dynamic so interaction code ships only where it's used.
// app/interactive-fluid-simulation/page.tsx (Next.js App Router)
"use client";
import dynamic from "next/dynamic";
// Heavy interactive code is split into its own chunk.
const Experiences3D = dynamic(
() => import("@/components/3d/experiences").then((m) => m.Experiences3D),
{ ssr: false, loading: () => <div aria-busy="true" style={{ height: 480 }} /> },
);
export default function Page() {
return (
<main>
<div style={{ height: 480 }}>
<Experiences3D
variant="fluid"
theme="light"
/>
</div>
</main>
);
}
TypeScript interfaces
export type Theme = "light" | "amoled";
export interface InteractiveFluidSimulationProps {
/** Which Advanced Interactive Experiences implementation to render */
variant: "fluid";
theme: Theme;
/* Visual */
color?: string; // default "#7777ff"
viscosity?: number; // 0–0.001, default 0.0001
diffusion?: number; // 0–0.001, default 0.00005
/* Interaction */
intensity?: number; // 0.2–3, default 1
/* Animation */
speed?: number; // 0–3, default 1
}
Props reference
| Prop | Type | Default | Group | Description |
|---|---|---|---|---|
| variant | "fluid" | — | Core | Selects the implementation. |
| theme | "light" | "amoled" | — | Core | Themes surfaces, materials and lighting. |
| color | string (hex) | "#7777ff" | Visual | Accent |
| viscosity | number | 0.0001 | Visual | Viscosity (0 – 0.001) |
| diffusion | number | 0.00005 | Visual | Diffusion (0 – 0.001) |
| intensity | number | 1 | Interaction | Ink intensity (0.2 – 3) |
| speed | number | 1 | Animation | Animation speed (0 – 3) |
Customization
Colour props accept any hex string. Content props accept plain strings. Every value shown in the playground maps 1:1 to a prop, so you can design visually and copy the generated code. Use Share to send a pre-configured link or Export to download the configuration JSON.
import { Experiences3D } from "@/components/3d/experiences";
export default function Example() {
return (
<div style={{ height: 480 }}>
<Experiences3D
variant="fluid"
theme="light"
color="#ff5a36"
/>
</div>
);
}
Animation settings
- intensityInk intensity · 0.2–3
- speedAnimation speed · 0–3
All motion is suspended when prefers-reduced-motion is on.
Theme support
Pass theme="light" or theme="amoled". Surfaces, borders, shadows and text switch via CSS variables (--bg, --card, --fg, --border, --accent). AMOLED uses true #000000. Use the theme switch in the playground toolbar to preview both.
Responsive behavior
The component fills its parent, so size it with the container. Use the playground’s desktop / tablet / mobile selector to test. Layouts use fluid widths and container-relative sizing.
Accessibility notes
- — Every canvas interaction has a DOM alternative (buttons, sliders, lists).
- — The museum is keyboard-walkable (WASD/arrows) with on-screen controls.
- — Audio never starts without an explicit user action.
Performance notes
- — Custom physics is O(n²) with a capped body count — tune it with the Count control.
- — Particle simulation updates typed arrays in place.
- — The fluid solver runs on a 80×80 grid and pauses off-screen.