Repository navigation
feat: added 2 animation component drag and jiggle - #52
Merged
Merged
Conversation
✅ Deploy Preview for zepaui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Component Name
draggable-animationandjiggle-animation— two WebGL components for theanimationssection.Description
draggable-animation— a drag-to-scrub slider where every slide is a Three.js plane rather than an image. Drag velocity feeds one uniform that bows the geometry along a sine and pulls the green and blue channels apart, so the chromatic smear only exists while you are moving. Each slide scales its texture from 0.65 to 1 as it crosses the frame, and the rail wraps infinitely — six planes cover an endless track via per-plane min/max wrap points. Photos are graded to near-monochrome in the fragment shader (luminance, shadow lift, flat multiply) after the channel split, so the smear survives the grade.jiggle-animation— click anywhere and the photo wobbles like struck water. The vertex shader measures each vertex's distance from the click point and rides a cosine outward from it; a hard vertical wipe reveals the next image on the same beat, so one gesture both shakes the old photo and changes it. White background, dark Zepa mark.Both are ports of Jesper Landberg CodePens, rewritten to be embed-safe: no
position: fixed, nowindow.innerWidth/innerHeight, nodocument.body, no global selectors. Every measurement is taken relative to the component's own root, and both prefix all classes.Preview
public/previews/animations/draggable-animation/preview.mov— 3.90 MB, 1280×694 @ 30fpspublic/previews/animations/jiggle-animation/preview.mov— 0.47 MB, 1280×694 @ 30fpsDependencies Added
None.
draggable-animationusesthree+gsap,jiggle-animationusesgsap— all already in the project.The jiggle reference was built on twgl, which is not installed. Rather than add a dependency for one effect, the four
m4helpers and the subdivided plane it provided are inlined (~80 lines) and verified against naive from-first-principles matrix maths.Notes
Three upstream issues were fixed rather than carried over:
vec4 textureno longer compiles. Three r184 targets GLSL ES 3.00 and injects#define texture2D texture, so the reference's accumulator shadows the built-in. Renamed tocolor. A repo-wide check confirms no other shader shadows a GLSL built-in or a three alias target.jigglecover-fit divided by zero. The reference'sif / else ifhas noelseand initialises both scales to0, so when the canvas aspect exactly matches the photo aspect the texcoords collapse to a single texel and the plane renders flat. Three of the four photos are exactly 3:2, so it was reachable. Both default to1.draggablehad no resize handling and would break on any window change; added aResizeObserverthat re-measures the rail.Both components are Strict-Mode safe: WebGL resources are created per mount and released on cleanup, without losing the shared context or aborting in-flight image loads.
Checklist
meta.tsdemo.tsxpublic/previews/{category}/{slug}/preview.mov)npm run build:registrynpm run lintnpm run testconsole.log