Clip Reveal
Images slide open like a curtain as you scroll.
Settings
What it does
Clip Reveal is an image animation ready for your AI assistant, React or plain JavaScript, with no dependencies. Also called image reveal, mask reveal or curtain reveal.
As a picture scrolls into view, a hard edge sweeps across it and uncovers the whole frame while the image eases back from a slight zoom. Choose the edge or open from the center. Reduced motion gets a soft fade instead.
Documentation
One copy gives an assistant everything it needs: the complete code, every option and every pitfall. Paste it in Claude, Cursor or ChatGPT and say where the effect goes; it adapts the integration to your stack, not the code.
Copy the prompt
Ask for it
For instance: Add this clip reveal effect to the hero of my home page.What it sends# Foundry44 · Clip Reveal Image is revealed by an expanding clip-path when scrolled into view. Add this component to my project. Pick the setup below that matches my project and follow only that one. When it uses the code at the end, keep its logic as written (it is self-contained, with no dependencies) and adapt only the integration: JavaScript instead of TypeScript if the project has none, file names, imports, how it starts. ## Markup it expects The element marked `data-f44="clip-reveal"`, with this structure inside. Texts, images and the number of items are the demo's: use mine. The `data-f44-*` attributes set options for the ready-made script only; with the code, pass the same options to `clipReveal()` or as props. ```html <div data-f44="clip-reveal"> <img src="image-1.jpg" alt="Cushion moss on grey stone"> </div> ``` ## Options | Option | Attribute | Type | Default | Description | |---|---|---|---|---| | `direction` | `data-f44-direction` | `ClipRevealDirection` | `up` | Which way the visible area grows: "up" opens from the bottom edge, "center" from the middle. | | `duration` | `data-f44-duration` | `number` | `1000` | Time in ms for the clip to open fully. | | `zoom` | `data-f44-zoom` | `number` | `1.1` | Starting scale of the element's first child, which settles to 1 as it is revealed. 1 turns it off. | | `once` | `data-f44-once` | `boolean` | `true` | Play only the first time the element enters the viewport. Otherwise it closes again once fully offscreen and replays. | ## Setup - **Plain HTML, no build step**: don't paste the code below. Load the ready-made script once, at the end of `<body>`: `<script src="https://foundry44.dev/demos/clip-reveal/clip-reveal.js" defer></script>` (or download that file and serve it with the page). It starts itself on every `data-f44="clip-reveal"` element and reads the `data-f44-*` attributes above. - **React / Next.js with shadcn/ui** (the project has a `components.json`; otherwise, see the next line): `npx shadcn@latest add https://foundry44.dev/r/clip-reveal.json` writes `lib/clip-reveal-core.ts` and `components/ui/clip-reveal.tsx`, then use `<ClipReveal />` with the options as props. - **React / Next.js from npm** (no shadcn/ui, or the user prefers a package): `npm install @foundry44/react` (or the project's package manager), then `import { ClipReveal } from "@foundry44/react"` with the options as props. With a bundler and no React: `@foundry44/core`, then `import { clipReveal } from "@foundry44/core/clip-reveal"`. - **React / Next.js by hand**: save the code below as `lib/clip-reveal-core.ts` and import it from there (`@/lib/clip-reveal-core` where that alias exists). Don't name it `clip-reveal.ts` next to a `ClipReveal.tsx`: on macOS and Windows the two names collide. In a component marked `"use client"`, call `clipReveal(ref.current, options)` in a `useEffect` and return `instance.destroy` as its cleanup; call `instance.update(options)` when options change. - **Any other stack**: create on mount with `clipReveal(element, options)`, `update(options)` when they change, `destroy()` on unmount. Only the ready-made script finds `data-f44` elements and starts them by itself. Pasted code does not: call `clipReveal(element)` on each element. ## Pitfalls - Respects prefers-reduced-motion: keep that behaviour. - Wrap the image: the zoom applies to the element's first child, never to the element itself (that would scale the clip too). Give the wrapper `overflow: hidden` so the zoomed child stays inside its rounded corners. - Without JavaScript, or until the script runs, the element is fully visible. - The element hides as soon as the script runs and opens once it is about 15% inside the viewport. On the first screen it plays on load, so load the script early to avoid a flash of the image. ## Code: `clip-reveal-core.ts` ```ts // Copyright (c) 2026 Foundry44 · MIT License (SPDX-License-Identifier: MIT) /** * Foundry44 — clip-reveal * When the element scrolls into view, a clip opens from one edge (or from the * center) until the whole element shows, like a curtain pulled away. The media * inside settles from a slight zoom at the same time, so the reveal has depth. * * Self-contained: no imports, so this file can be copied as-is. */ export type ClipRevealDirection = "up" | "down" | "left" | "right" | "center"; export interface ClipRevealOptions { /** Which way the visible area grows: "up" opens from the bottom edge, "center" from the middle. */ direction?: ClipRevealDirection; /** Time in ms for the clip to open fully. @range 200 3000 50 */ duration?: number; /** Starting scale of the element's first child, which settles to 1 as it is revealed. 1 turns it off. @range 1 1.5 0.01 */ zoom?: number; /** Play only the first time the element enters the viewport. Otherwise it closes again once fully offscreen and replays. */ once?: boolean; } export interface ClipRevealInstance { update(options: ClipRevealOptions): void; destroy(): void; } export const clipRevealDefaults: Required<ClipRevealOptions> = { direction: "up", duration: 1000, zoom: 1.1, once: true, }; const EASE_OUT = "cubic-bezier(0.23, 1, 0.32, 1)"; const REDUCED_DURATION = 300; const SHOWN_CLIP = "inset(0 0 0 0)"; // inset(top right bottom left): the side that starts at 100% is the one the reveal moves away from. const HIDDEN_CLIPS: Record<ClipRevealDirection, string> = { up: "inset(100% 0 0 0)", down: "inset(0 0 100% 0)", left: "inset(0 0 0 100%)", right: "inset(0 100% 0 0)", center: "inset(50% 50% 50% 50%)", }; export function clipReveal(el: HTMLElement, options: ClipRevealOptions = {}): ClipRevealInstance { let opts = { ...clipRevealDefaults, ...options }; if (typeof window === "undefined") return { update() {}, destroy() {} }; // Reduced motion: no moving edge and no zoom, the element simply fades in. const reduced = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true; // The zoom goes on the child, not the element: scaling the element would scale its clip too. const media = el.firstElementChild instanceof HTMLElement ? el.firstElementChild : null; const original = { clipPath: el.style.clipPath, opacity: el.style.opacity, transition: el.style.transition, mediaTransform: media?.style.transform ?? "", mediaTransition: media?.style.transition ?? "", }; let observer: IntersectionObserver | null = null; let shown = false; let played = false; const hiddenClip = () => HIDDEN_CLIPS[opts.direction] ?? HIDDEN_CLIPS.up; const applyHidden = () => { el.style.transition = "none"; if (reduced) { el.style.opacity = "0"; return; } el.style.clipPath = hiddenClip(); if (media) { media.style.transition = "none"; media.style.transform = opts.zoom === 1 ? original.mediaTransform : `scale(${opts.zoom})`; } }; const show = () => { if (shown) return; shown = true; played = true; // Flush the hidden state so the transition has a start value. void el.offsetWidth; if (reduced) { el.style.transition = `opacity ${REDUCED_DURATION}ms ease`; el.style.opacity = original.opacity; return; } el.style.transition = `clip-path ${opts.duration}ms ${EASE_OUT}`; el.style.clipPath = SHOWN_CLIP; if (media && opts.zoom !== 1) { media.style.transition = `transform ${opts.duration}ms ${EASE_OUT}`; media.style.transform = original.mediaTransform; } }; const hide = () => { if (!shown) return; shown = false; applyHidden(); }; const bind = () => { if (opts.once && played) return; if (typeof IntersectionObserver === "undefined") { show(); return; } observer = new IntersectionObserver( (entries) => { for (const entry of entries) { if (entry.isIntersecting) { show(); if (opts.once) unbind(); continue; } // The observed area is shrunk at the bottom, so "not intersecting" can still be // partly on screen: close only once the element is entirely out of sight. const { top, bottom } = entry.boundingClientRect; if (bottom <= 0 || top >= window.innerHeight) hide(); } }, // Wait until the element is a little inside the viewport so the opening is actually seen. { rootMargin: "0px 0px -15% 0px" }, ); observer.observe(el); }; const unbind = () => { observer?.disconnect(); observer = null; }; applyHidden(); bind(); return { update(next) { const previous = opts; opts = { ...opts, ...next }; // duration is read when a reveal starts; direction and zoom only matter while hidden. if (!shown) applyHidden(); if (opts.once !== previous.once) { unbind(); bind(); } }, destroy() { unbind(); el.style.clipPath = original.clipPath; el.style.opacity = original.opacity; el.style.transition = original.transition; if (media) { media.style.transform = original.mediaTransform; media.style.transition = original.mediaTransition; } }, }; } ```
Two files that become yours: the engine, written without React, and a thin component around it. No package to install. The component is marked use client, so it sits inside a server component as it is.
Add it with the shadcn CLI
In a project set up for shadcn/ui, one command writes both files. Without it, copy them by hand in the two steps below.npx shadcn@latest add https://foundry44.dev/r/clip-reveal.json
Or add the engine by hand
Save it aslib/clip-reveal-core.ts. It has no dependencies and does nothing on the server.And the component
Save it ascomponents/ui/clip-reveal.tsx. It creates the effect on mount, passes every prop change to it live, and cleans up on unmount.// Copyright (c) 2026 Foundry44 · MIT License (SPDX-License-Identifier: MIT) // Generated by scripts/generate.mjs. Do not edit: change the core component instead. "use client"; import { useEffect, useRef, type ComponentPropsWithoutRef } from "react"; import { clipReveal, type ClipRevealOptions, type ClipRevealInstance } from "@/lib/clip-reveal-core"; export interface ClipRevealProps extends ClipRevealOptions, Omit<ComponentPropsWithoutRef<"div">, keyof ClipRevealOptions> {} export function ClipReveal({ direction, duration, zoom, once, style, ...props }: ClipRevealProps) { const ref = useRef<HTMLElementTagNameMap["div"]>(null); const instance = useRef<ClipRevealInstance | null>(null); useEffect(() => { if (!ref.current) return; instance.current = clipReveal(ref.current); return () => { instance.current?.destroy(); instance.current = null; }; }, []); // Runs right after creation, then on every option change. useEffect(() => { instance.current?.update(definedOnly({ direction, duration, zoom, once })); }, [direction, duration, zoom, once]); return <div ref={ref} style={style} {...props} />; } function definedOnly<T extends object>(o: T): T { return Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined)) as T; }
Or install the package
It is also on npm, in@foundry44/reactwith the other free components. Import it from there instead of@/components/ui.npm install @foundry44/react
import { ClipReveal } from "@foundry44/react";
Use it
Every prop is optional: with none, you get the effect as the preview shows it.import { ClipReveal } from "@/components/ui/clip-reveal"; export function Example() { return ( <ClipReveal direction="up" duration={1000} zoom={1.1} once={true} > {/* your content */} </ClipReveal> ); }
PropsProp Default What it is direction up Which way the visible area grows: "up" opens from the bottom edge, "center" from the middle. duration 1000 Time in ms for the clip to open fully. zoom 1.1 Starting scale of the element's first child, which settles to 1 as it is revealed. 1 turns it off. once true Play only the first time the element enters the viewport. Otherwise it closes again once fully offscreen and replays. Avoid the pitfalls
- It follows
prefers-reduced-motion: under reduced motion the effect settles at once. - Wrap the image: the zoom applies to the element's first child, never to the element itself (that would scale the clip too). Give the wrapper
overflow: hiddenso the zoomed child stays inside its rounded corners. - Without JavaScript, or until the script runs, the element is fully visible.
- The element hides as soon as the script runs and opens once it is about 15% inside the viewport. On the first screen it plays on load, so load the script early to avoid a flash of the image.
- It follows
One file, readable, no dependencies and no build step. It sets itself up on every element marked data-f44="clip-reveal", in plain HTML, WordPress, Framer embeds or any framework.
Load the script
Download it, put it next to your page and load it once, anywhere in the page.<script src="clip-reveal.js" defer></script>
The file/*! * Foundry44 · Clip Reveal — https://foundry44.dev/components/clip-reveal * Image is revealed by an expanding clip-path when scrolled into view. * Copyright (c) 2026 Foundry44 · MIT License (SPDX-License-Identifier: MIT) * * Usage: load this file, then add data-f44="clip-reveal" to any element. * Optional attributes (defaults shown): * data-f44-direction="up" * data-f44-duration="1000" * data-f44-zoom="1.1" * data-f44-once="true" * Manual: const instance = Foundry44.clipReveal(element, { direction: "up", duration: 1000, zoom: 1.1, once: true }); * instance.destroy(); * Re-scan the page after adding elements dynamically: Foundry44.init(); * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ (function () { "use strict"; /** * Foundry44 — clip-reveal * When the element scrolls into view, a clip opens from one edge (or from the * center) until the whole element shows, like a curtain pulled away. The media * inside settles from a slight zoom at the same time, so the reveal has depth. * * Self-contained: no imports, so this file can be copied as-is. */ const clipRevealDefaults = { direction: "up", duration: 1000, zoom: 1.1, once: true, }; const EASE_OUT = "cubic-bezier(0.23, 1, 0.32, 1)"; const REDUCED_DURATION = 300; const SHOWN_CLIP = "inset(0 0 0 0)"; // inset(top right bottom left): the side that starts at 100% is the one the reveal moves away from. const HIDDEN_CLIPS = { up: "inset(100% 0 0 0)", down: "inset(0 0 100% 0)", left: "inset(0 0 0 100%)", right: "inset(0 100% 0 0)", center: "inset(50% 50% 50% 50%)", }; function clipReveal(el, options = {}) { var _a, _b, _c; let opts = { ...clipRevealDefaults, ...options }; if (typeof window === "undefined") return { update() {}, destroy() {} }; // Reduced motion: no moving edge and no zoom, the element simply fades in. const reduced = ((_a = window.matchMedia) === null || _a === void 0 ? void 0 : _a.call(window, "(prefers-reduced-motion: reduce)").matches) === true; // The zoom goes on the child, not the element: scaling the element would scale its clip too. const media = el.firstElementChild instanceof HTMLElement ? el.firstElementChild : null; const original = { clipPath: el.style.clipPath, opacity: el.style.opacity, transition: el.style.transition, mediaTransform: (_b = media === null || media === void 0 ? void 0 : media.style.transform) !== null && _b !== void 0 ? _b : "", mediaTransition: (_c = media === null || media === void 0 ? void 0 : media.style.transition) !== null && _c !== void 0 ? _c : "", }; let observer = null; let shown = false; let played = false; const hiddenClip = () => { var _a; return (_a = HIDDEN_CLIPS[opts.direction]) !== null && _a !== void 0 ? _a : HIDDEN_CLIPS.up; }; const applyHidden = () => { el.style.transition = "none"; if (reduced) { el.style.opacity = "0"; return; } el.style.clipPath = hiddenClip(); if (media) { media.style.transition = "none"; media.style.transform = opts.zoom === 1 ? original.mediaTransform : `scale(${opts.zoom})`; } }; const show = () => { if (shown) return; shown = true; played = true; // Flush the hidden state so the transition has a start value. void el.offsetWidth; if (reduced) { el.style.transition = `opacity ${REDUCED_DURATION}ms ease`; el.style.opacity = original.opacity; return; } el.style.transition = `clip-path ${opts.duration}ms ${EASE_OUT}`; el.style.clipPath = SHOWN_CLIP; if (media && opts.zoom !== 1) { media.style.transition = `transform ${opts.duration}ms ${EASE_OUT}`; media.style.transform = original.mediaTransform; } }; const hide = () => { if (!shown) return; shown = false; applyHidden(); }; const bind = () => { if (opts.once && played) return; if (typeof IntersectionObserver === "undefined") { show(); return; } observer = new IntersectionObserver( (entries) => { for (const entry of entries) { if (entry.isIntersecting) { show(); if (opts.once) unbind(); continue; } // The observed area is shrunk at the bottom, so "not intersecting" can still be // partly on screen: close only once the element is entirely out of sight. const { top, bottom } = entry.boundingClientRect; if (bottom <= 0 || top >= window.innerHeight) hide(); } }, // Wait until the element is a little inside the viewport so the opening is actually seen. { rootMargin: "0px 0px -15% 0px" }, ); observer.observe(el); }; const unbind = () => { observer === null || observer === void 0 ? void 0 : observer.disconnect(); observer = null; }; applyHidden(); bind(); return { update(next) { const previous = opts; opts = { ...opts, ...next }; // duration is read when a reveal starts; direction and zoom only matter while hidden. if (!shown) applyHidden(); if (opts.once !== previous.once) { unbind(); bind(); } }, destroy() { unbind(); el.style.clipPath = original.clipPath; el.style.opacity = original.opacity; el.style.transition = original.transition; if (media) { media.style.transform = original.mediaTransform; media.style.transition = original.mediaTransition; } }, }; } function parse(value) { if (value === "true") return true; if (value === "false") return false; var n = Number(value); return value !== "" && !isNaN(n) ? n : value; } function init() { document.querySelectorAll('[data-f44="clip-reveal"]').forEach(function (el) { if (el.__f44) return; var options = {}; [ ["direction", "data-f44-direction"], ["duration", "data-f44-duration"], ["zoom", "data-f44-zoom"], ["once", "data-f44-once"], ].forEach(function (pair) { var value = el.getAttribute(pair[1]); if (value !== null) options[pair[0]] = parse(value); }); el.__f44 = clipReveal(el, options); }); } var Foundry44 = (window.Foundry44 = window.Foundry44 || {}); Foundry44.clipReveal = clipReveal; Foundry44._inits = Foundry44._inits || []; Foundry44._inits.push(init); Foundry44.init = function () { Foundry44._inits.forEach(function (fn) { fn(); }); }; if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", init); else init(); })();
Mark your element
Adddata-f44="clip-reveal". Each setting is an attribute on the same element, and an attribute always wins over the default.<div data-f44="clip-reveal" data-f44-direction="up"> <!-- your content --> </div>
SettingsAttribute Default What it is data-f44-direction up Which way the visible area grows: "up" opens from the bottom edge, "center" from the middle. data-f44-duration 1000 Time in ms for the clip to open fully. data-f44-zoom 1.1 Starting scale of the element's first child, which settles to 1 as it is revealed. 1 turns it off. data-f44-once true Play only the first time the element enters the viewport. Otherwise it closes again once fully offscreen and replays. Drive it from JavaScript
When the element arrives after the page has loaded, or when the settings come from your code.// an element without data-f44, or the script would set it up twice const element = document.querySelector(".my-element"); const instance = Foundry44.clipReveal(element, { direction: "up", duration: 1000 }); instance.update({ direction: "up" }); // any option, live instance.destroy(); // listeners and observers gone, inline styles restored // elements added after the page loaded Foundry44.init();
Avoid the pitfalls
- It follows
prefers-reduced-motion: under reduced motion the effect settles at once. - Wrap the image: the zoom applies to the element's first child, never to the element itself (that would scale the clip too). Give the wrapper
overflow: hiddenso the zoomed child stays inside its rounded corners. - Without JavaScript, or until the script runs, the element is fully visible.
- The element hides as soon as the script runs and opens once it is about 15% inside the viewport. On the first screen it plays on load, so load the script early to avoid a flash of the image.
- It follows
For a site builder: Webflow, WordPress, Shopify, Framer, or any site that accepts HTML. One block carries the whole script; paste it, then mark an element.
Paste the embed
Paste it where your builder takes custom HTML: an embed or code block on the page, or the site's footer code to use the effect on every page.Mark the element
Give the element the attributedata-f44with the valueclip-reveal. Most builders have a field for custom attributes; otherwise, add it to the element's HTML.SettingsEvery setting is an attribute too, on the same element. Leave one out and the default applies.Attribute Default What it is data-f44-direction up Which way the visible area grows: "up" opens from the bottom edge, "center" from the middle. data-f44-duration 1000 Time in ms for the clip to open fully. data-f44-zoom 1.1 Starting scale of the element's first child, which settles to 1 as it is revealed. 1 turns it off. data-f44-once true Play only the first time the element enters the viewport. Otherwise it closes again once fully offscreen and replays. Avoid the pitfalls
- It follows
prefers-reduced-motion: under reduced motion the effect settles at once. - Wrap the image: the zoom applies to the element's first child, never to the element itself (that would scale the clip too). Give the wrapper
overflow: hiddenso the zoomed child stays inside its rounded corners. - Without JavaScript, or until the script runs, the element is fully visible.
- The element hides as soon as the script runs and opens once it is about 15% inside the viewport. On the first screen it plays on load, so load the script early to avoid a flash of the image.
- It follows