Flow Art
Colour-block sections that swing in over each other as you scroll.
Customize
<FlowArt children={children} />Changes show live and stay in the address, so a link keeps them.
Code
"use client";
import { useRef, type CSSProperties, type ReactNode } from "react";
import { gsap } from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { useGSAP } from "@gsap/react";
// Big colour-block sections that flow into each other. As you scroll, the next section swings in
// from a tilted angle (like a page being turned) while the section before it stays pinned underneath.
// Two small pieces:
// <FlowArt> wraps everything and runs the animation
// <FlowSection> one coloured panel. Put any content inside it.
if (typeof window !== "undefined") gsap.registerPlugin(useGSAP, ScrollTrigger);
export type FlowArtProps = {
/** The sections, in order. Use <FlowSection> for each one. */
children: ReactNode;
/** How far each section is tilted before it swings in, in degrees. */
angle?: number;
/** Which bottom corner the section swings around: the left one or the right one. */
from?: "left" | "right";
/** Where on the screen the swing ends, as a fraction of the screen height from the top. 0.25 means a quarter of the way down. */
settle?: number;
/** Keep every section pinned in place while the next one covers it. Off, they scroll away normally. */
pin?: boolean;
/** How long the swing takes to catch up with the scrollbar, in seconds. 0 locks it to the scrollbar. */
smoothing?: number;
/** The scrolling element. Leave it out to use the page; give it a selector or an element for an inner scroller. */
scroller?: string | HTMLElement | Window;
/** Extra classes for the outer wrapper. */
className?: string;
};
export function FlowArt({ children, angle = 30, from = "left", settle = 0.25, pin = true, smoothing = 0, scroller, className = "" }: FlowArtProps) {
const rootRef = useRef<HTMLDivElement>(null);
useGSAP(
() => {
const root = rootRef.current;
if (!root) return;
const mm = gsap.matchMedia();
// Reduced motion: no tilting and no pinning. The sections are just a plain coloured page.
mm.add("(prefers-reduced-motion: no-preference)", () => {
const sections = gsap.utils.toArray<HTMLElement>("[data-flow-section]", root);
// Swinging round the right corner means turning the other way
const direction = from === "right" ? -1 : 1;
const origin = from === "right" ? "bottom right" : "bottom left";
sections.forEach((section, index) => {
const panel = section.querySelector<HTMLElement>("[data-flow-panel]");
if (!panel) return;
// The first section is simply there. Every other one swings in while it climbs the screen.
// scrub ties the swing to the scrollbar, so it swings back out when you scroll up.
if (index > 0) {
gsap.fromTo(
panel,
{ rotation: angle * direction, transformOrigin: origin },
{
rotation: 0,
ease: "none",
force3D: true,
scrollTrigger: { trigger: section, scroller, start: "top bottom", end: `top ${settle * 100}%`, scrub: smoothing > 0 ? smoothing : true },
},
);
}
// Hold the section still, with the next one sliding over the top of it. A section taller than
// the screen pins by its bottom edge, so everything in it has been scrolled past first.
if (pin && index < sections.length - 1) {
ScrollTrigger.create({ trigger: section, scroller, start: "bottom bottom", end: "bottom top", pin: true, pinSpacing: false });
}
});
// Fonts and pictures arriving late change the heights, so measure the pins again.
// A short delay turns a burst of changes into one measurement.
let measure: gsap.core.Tween | undefined;
const measureSoon = () => {
measure?.kill();
measure = gsap.delayedCall(0.2, () => ScrollTrigger.refresh());
};
const observer = new ResizeObserver(measureSoon);
// Only the wrapper: a pinned section changes its own box while it sticks, which must not re-trigger this
observer.observe(root);
let cancelled = false;
document.fonts?.ready.then(() => {
if (!cancelled) measureSoon();
});
return () => {
cancelled = true;
measure?.kill();
observer.disconnect();
};
});
return () => mm.revert();
},
{ scope: rootRef, dependencies: [angle, from, settle, pin, smoothing, scroller], revertOnUpdate: true },
);
return (
<div ref={rootRef} className={`relative w-full overflow-x-clip ${className}`}>
{children}
</div>
);
}
export type FlowSectionProps = {
/** What the section shows. */
children: ReactNode;
/** Extra classes for the coloured panel: the background, text colour and padding go here. */
className?: string;
/** Inline styles for the panel, e.g. a background colour. */
style?: CSSProperties;
};
/** One coloured panel. It is the panel (not the section around it) that swings in, so the corners cut into the section below. */
export function FlowSection({ children, className = "", style }: FlowSectionProps) {
return (
<section data-flow-section className="relative w-full overflow-hidden">
<div
data-flow-panel
className={`relative flex min-h-[100svh] w-full flex-col justify-between gap-6 px-[max(1.25rem,4vw)] pt-[max(2rem,4vw)] pb-[max(1.5rem,4vw)] ${className}`}
style={{ transformOrigin: "bottom left", willChange: "transform", ...style }}
>
{children}
</div>
</section>
);
}
The component. Installs to components/dimaac/flow-art.tsx.
Install
With the shadcn CLI
npx shadcn@latest add https://ui.dimaac.com/r/flow-art.jsonIt adds components/dimaac/flow-art.tsx and installs what it imports. With the @dimaac namespace in components.json (Docs) it's just npx shadcn@latest add @dimaac/flow-art.
By hand
npm install gsap @gsap/react- Install the packages it uses: gsap, @gsap/react.
- Copy the component file below into components/dimaac/flow-art.tsx.
- It's styled with Tailwind v4 classes. If that folder sits outside the places Tailwind scans, add it with @source in your CSS.
- Import it with import { FlowArt } from "@/components/dimaac/flow-art". Give its parent a size: it fills it.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children (required) | ReactNode | - | The sections, in order. Use <FlowSection> for each one. |
angle | number | 30 | How far each section is tilted before it swings in, in degrees. |
from | "left" | "right" | "left" | Which bottom corner the section swings around: the left one or the right one. |
settle | number | 0.25 | Where on the screen the swing ends, as a fraction of the screen height from the top. 0.25 means a quarter of the way down. |
pin | boolean | true | Keep every section pinned in place while the next one covers it. Off, they scroll away normally. |
smoothing | number | 0 | How long the swing takes to catch up with the scrollbar, in seconds. 0 locks it to the scrollbar. |
scroller | string | HTMLElement | Window | - | The scrolling element. Leave it out to use the page; give it a selector or an element for an inner scroller. |
className | string | "" | Extra classes for the outer wrapper. |
Use with AI
Agent prompt
Paste it into Claude Code, Cursor or any coding agent, or open it straight in a chat. It carries your Customize settings.
Add the Flow Art component (<FlowArt />) from DiMaac UI to this project.
Docs: https://ui.dimaac.com/components/flow-art
Source and dependencies (shadcn registry JSON): https://ui.dimaac.com/r/flow-art.json
Install it with:
npx shadcn@latest add https://ui.dimaac.com/r/flow-art.json
Then use it like this:
import { FlowArt } from "@/components/dimaac/flow-art";
<FlowArt children={children} />
If the shadcn CLI isn't set up here, fetch the registry JSON above, write files[0].content to components/dimaac/flow-art.tsx and install gsap, @gsap/react.
It uses Tailwind v4 classes, so make sure Tailwind scans that folder. Give its parent a size: it fills it. Keep light and dark mode working and keep its prefers-reduced-motion fallback.
Full index for agents: https://ui.dimaac.com/llms.txtFiles agents read
- llms.txt
- Every component and how to install it
- flow-art.md
- This page as Markdown: install, props and the full source
- flow-art.json
- The shadcn registry item
About
A stack of big editorial colour blocks. As you scroll, each new section swings in from a tilted angle around its bottom corner, like a page being turned, while the section before it stays pinned underneath. The swing is scrubbed to the scrollbar, so it swings back out when you scroll up. Tune the angle, the corner it pivots on, where on the screen it settles, and whether the old sections pin. It works on the page or inside any scrolling element through the scroller prop, handles sections taller than the screen, measures again when fonts and pictures arrive, and falls back to a plain coloured page when the visitor prefers reduced motion. Ported from the first DiMaac UI, with its site-only scroll context replaced by a scroller prop. Two small parts: FlowArt and FlowSection.
- Installs to
components/dimaac/flow-art.tsx- Uses
- gsap, @gsap/react
- Tags
- scrolltrigger, pin, scrub, sections, editorial
Modern Sculpture Display by rena on Lummi (Lummi License). Surreal 3D Planet Scene by Ricardo Matos on Lummi (Lummi License). Abstract Sculptural Objects by Dona Mara on Lummi (Lummi License). Vibrant Cylindrical Arrangement by SHIHO on Lummi (Lummi License). Abstract Wavy Design by rena on Lummi (Lummi License). Glossy Pink Sphere by marisol on Lummi (Lummi License).