create-photo-grid-ripples
| additional_license_urls | https://github.com/MengTo/Skills/blob/2f8cb46167bec49ee3c4a6ca37972fc065b6b47e/agent-skills/web-design/create-photo-grid-ripples/demo/assets/THREE-LICENSE.txt |
|---|---|
| description | Give a flat photograph a 3D appearance using a depth-warped triangular grid, hover highlights and a click or tap that scatters dots and refracts the photograph. Use for image interactions without a 3D model. |
| import_scope | signals-cleared-supporting-files |
| license | MIT |
| license_url | https://github.com/MengTo/Skills/blob/2f8cb46167bec49ee3c4a6ca37972fc065b6b47e/LICENSE |
| name | create-photo-grid-ripples |
| publisher | MengTo |
| repository_url | https://github.com/MengTo/Skills |
| source_url | https://github.com/MengTo/Skills/blob/2f8cb46167bec49ee3c4a6ca37972fc065b6b47e/agent-skills/web-design/create-photo-grid-ripples/SKILL.md |
| upstream_copyright | Copyright (c) 2026 Meng To, Copyright © 2010-2025 three.js authors |
| upstream_revision | 2f8cb46167bec49ee3c4a6ca37972fc065b6b47e |
Create Photo Grid Ripples
Project a triangular lattice through a depth map, then drive the image distortion and the released nodes from a single expanding wave. The image stays on one rectangular plane. For an existing mesh, use its real surface coordinates instead.
Register the image
Use a cutout with reliable alpha and an aligned depth map, white toward the viewer. A hand-painted soft dome with raised features works for an initial pass. See main.js. Measure the visible image rectangle after object-fit and cropping. Derive pointer UV from that rectangle. Use top-left coordinates for Canvas and invert Y once for WebGL. The demo uses a square plane. For other crops scale horizontal distance by width divided by height before measuring the radius, then undo that scale on displacement.
Wrap the grid
- In ripple.js, offset UV by local depth, compress toward the temples, then calculate
cell = (42x + 21y, 36.4y). Use the three lane coordinatesu, v, u − v. Tune the warp to the new subject’s landmarks. - Use surface-grid.js to divide distance to each lane by its screen derivative. This holds the wires near one backing pixel. Draw round nodes at crossings. Fade toward the eyes and transparent boundary.
- Ease hover strength in a local radius of 15% of the image height, clamped to 58–135 backing pixels. Blend cool lines and warm dots with overlay math. Sample the red and blue channels about two pixels apart near the pointer. Reject hits in transparent space. Check readability over both hair and bright cheeks.
Release a wave
- On primary pointer-up, reject cancelled gestures, drags over 9 CSS pixels and alpha below 145/255. Start a new 860 ms clock at the hit. Offer a keyboard-accessible trigger at a known opaque point.
- For normalized time
tuseradius = .54 * (1 − (1 − t)^1.72)andband = .058 + .027t. Multiply a sine of signed distance to the front by a Gaussian envelope. Fade in over the first 7% and out after 58%. Refract the photograph along the radial slope using an index of 1.46. Sample RGBA together so the silhouette travels with the wave. - In particles.js, invert the same warp with four short iterations at each lattice intersection. Cache solid points and their neighbors. Push them outward under the front, shorten connecting lines, then settle them to their original positions. Change both projections together when adapting the field.
Verify
Click a recognizable edge such as the glasses. It should bend as the dots pass and return cleanly. Check off-center clicks, quick repeats, drag scrolling, resizing and empty corners. Disable displacement and scatter for reduced motion. Keep the original photo visible without WebGL. Suspend rendering offscreen.
Run the example
From this skill folder, run python3 -m http.server 4173 --bind 127.0.0.1 -d demo and open the local demo. The demo runs without a build or remote assets. See the preview and recreation prompts.
Adapted from the Stillhertz landing page. Keep the host project's typography, subject and layout. Bring over only the relevant technique. The sample is a single page. For a routed application, cancel animation frames, remove listeners, disconnect observers and dispose GPU resources on unmount.
Copyright (c) 2026 Meng To Copyright © 2010-2025 three.js authors
The license files are attached. MIT · MIT
The attached ZIP contains the pinned supporting files cleared for import. Applicable license notices are attached or included when cleared.
Like how this is organised?
Build your own Memory tree on knowen.md: notes, decisions and tasks in one connected markdown graph, shared with your team and your AI agents.