Prismatic Triangles

v1.0.0
FreeShowcase & MediaWebGLpowered by @vectorvesper/motion

Your image seen through a wall of faceted glass. Each triangle bends the picture at its own angle and splits the colour at its edges, and the facets lean toward the pointer as it passes. Shows the plain image under reduced motion.

Prismatic Triangles

Installation

Step 1. Initialize ProjectOne-time setup

Run once in your project root to configure paths and dependencies:

npx vectorvesper init
Step 2. Add ComponentInstalls source & assets

Downloads and registers the component in your project:

npx vectorvesper add prismatic-triangles
Step 3. Required DependenciesAuto-installed with CLI

If installing manually or managing your package lock:

npm install @vectorvesper/motion three
Packages:@vectorvesper/motionthree

Usage

A hero or feature panel where one strong image should feel like it sits behind glass: a product shot, a portrait, architecture. Bold colour and clear shapes refract best; a busy or low-contrast image turns to noise.

Usage

import { PrismaticTriangles } from "@/components/vv/prismatic-triangles";

export function Hero() {
  return (
    <PrismaticTriangles src="/hero.jpg" position="50% 30%" style={{ height: "100svh" }}>
      <h1 style={{ padding: "20vh 6vw", color: "#fff" }}>Through the glass</h1>
    </PrismaticTriangles>
  );
}

Do

  • Use position to keep the subject in view when the image is cropped to fit.
  • Keep refraction low when text sits on top; the higher it goes, the more the picture breaks up.

Don't

  • Do not pass a small image. It is stretched to cover the area, and the facets magnify any blur.

WebGL — render it on the client only

On Next.js, load it with ssr: false from a Client Component, as below. Vite apps need nothing extra.

"use client";

import dynamic from "next/dynamic";

const PrismaticTriangles = dynamic(
  () => import("@/components/vv/prismatic-triangles").then((m) => m.PrismaticTriangles),
  { ssr: false }
);
This component respects prefers-reduced-motion and provides a graceful fallback.

Props

Your image seen through a wall of faceted glass. Each triangle bends the picture at its own angle and splits the colour at its edges, and the facets near the pointer lean toward it and catch the light.

<PrismaticTriangles />

The glass and the image behind it. Fills the area, which is 100svh tall unless you size it.

PropTypeDefaultDescription
src*string—The image behind the glass. It fills the area the way `object-fit: cover` does.
positionstring"50% 50%"Which part of the image stays in view when it is cropped, as CSS `object-position`.
densitynumber5How many triangles fit the height.
refractionnumber0.035How far each facet bends the image, as a share of the height.
dispersionnumber0.35How much the bent image splits into colour, 0 to 1.
tiltnumber0.8How far the facets lean, 0 to 2.
speednumber0.25How fast the light turns.
glownumber1How bright the edges near the pointer get. 0 turns it off.
reachnumber0.45How far the pointer reaches, as a share of the height.
classNamestring—Sizes the area. Without a height it is 100svh tall.
styleReact.CSSProperties—Inline styles for the area. A height here wins over the default.
childrenReact.ReactNode—Content drawn over the glass.
Under reduced motion it shows the plain image, without the glass.
Runs on the Vector Vesper runtime: it stops drawing when it is off screen, draws at a lower resolution on a slow device, and comes back by itself if the browser drops its graphics context.
Client component. It renders its still state on the server and starts drawing once it mounts, so it is safe in a server-rendered route.

Source

/**
 * Prismatic Triangles — Vector Vesper
 * https://vectorvesper.dev/components
 *
 * Copyright (c) 2026 Vector Vesper
 * Released under the MIT License. This notice must be retained in copies and
 * substantial portions of the file. https://vectorvesper.dev/license
 */
export * from "./PrismaticTriangles";
export { default } from "./PrismaticTriangles";
View on GitHubReport an issue