Skip to content

DOM disintegrate effect: spark motion default + trademark-safe rename - #155

Open
mkayander wants to merge 21 commits into
mainfrom
cursor/windy-particle-motion-543f
Open

DOM disintegrate effect: spark motion default + trademark-safe rename#155
mkayander wants to merge 21 commits into
mainfrom
cursor/windy-particle-motion-543f

Conversation

@mkayander

@mkayander mkayander commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Renames the effect package to domDisintegrate (trademark-safe)
  • Windy spark motion is the default: sustained up-right drift with per-particle turbulence
  • Adaptive quality only on genuinely constrained hardware — flagship phones keep full desktop quality
  • Multi-layer performance optimizations across capture, warm-up, and the animation loop

Performance optimizations

Animation loop (prior commit + this one)

Change Impact
Windy-specific canvas padding ~35% smaller particle buffer
Dirty-region canvas clears Only clears particle bounds each frame
Cached spark turbulence profile Hash work at spawn, not per frame
Dead-particle skip Faded particles skip physics
Radial mask CSS variables Skips redundant gradient string rebuilds
Chunk mask index cache Skips DOM writes when step unchanged
Deferred overlay sync Scroll/resize listeners only
Active-particle tracker Step/draw scan only released+alive particles
setTransform draw path Avoids save/restore per rotated particle

Capture & warm-up (this commit)

Change Impact
Downsampled getImageData Reads one pixel per particle cell (~9× fewer pixels at step 3)
Warm chunk mask prebuild Chunk masks built during idle warm-up; reused at dismiss when strategy matches

Cookie banner uses maskMode: "radial" so chunk warm-up does not apply there, but downsampled capture and active-particle tracking do.

Testing

  • pnpm exec vitest run src/shared/ui/effects/domDisintegrate/__tests__ — 87 tests
  • pnpm lint
Open in Web Open in Cursor 

Introduce particleMotionMode with splat (radial burst) and windy
(flow-field turbulence) physics. Windy mode uses Perlin-style noise to
steer particles along curved gust paths, with lighter gravity and
stronger horizontal carry. Defaults to windy; splat remains available
via particleMotionMode: "splat".
@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dstruct Ready Ready Preview Aug 3, 2026 8:49am

Replace horizontal flow-field gusts with upward spark launch, high-frequency
flutter, decaying buoyancy lift, and a gravity arc. Sparks fade faster and
wobble more like embers than wind-blown dust.
@cursor cursor Bot changed the title Add windy particle motion mode as default for Thanos disintegrate Add fire-spark particle motion as default for Thanos disintegrate Aug 1, 2026
- Remove 80-line windTurbulence.ts (Perlin only contributed tiny drift)
- Add sparkFlutter.ts and sparkParticlePhysics.ts with clear naming
- Centralize motion profiles and spark constants
- Fix getParticleRevealMargin double-resolve
- Drop noise implementation-detail test
Require agents to implement important and medium fixes, and always
remove dead or duplicated code in the same session. Document severity
tiers, workflow, and output format. Cross-link from AGENTS.md and
.cursorrules.
Move .cursor/commands/deep-code-review.md to
.cursor/skills/deep-code-review/SKILL.md with disable-model-invocation.
Update AGENTS.md and .cursorrules cross-links. Project rules stay as
always-on .mdc files.
Add trigger-rich description, workflow checklist, severity table, output
template, and concrete example. Tighten prose per skill authoring
best practices.
Remove disable-model-invocation so agents auto-apply fix-in-place
review rules when users ask to review changes, diffs, or PRs — not
only on explicit /deep-code-review. Expand description triggers.
Replace thanosDisintegrate module, types, hooks, and docs with
domDisintegrate naming. Planned public package: @dstruct/dom-disintegrate.
All 67 effect tests pass.
@cursor cursor Bot changed the title Add fire-spark particle motion as default for Thanos disintegrate DOM disintegrate effect: spark motion default + trademark-safe rename Aug 1, 2026
- Retune flutter to slower sine waves keyed on time since release
- Boost lateral sway, reduce drag, extend buoyancy/fade, stronger launch
- Extract createTestDisintegrateParticle; fix padding double-resolve
- Fix stale turbulenceSeed comment; drop legacy .cursor/commands note
- Steer lateral velocity along a high-frequency sine for visible zig-zag legs
- Extend fade duration and buoyancy for longer flight before disappearing
- Widen canvas padding to account for zig-zag lateral extent
Replace synchronized sine steering with position-based turbulence:
per-particle frequency/phase/influence, vertical-travel-proportional
sway, and scattered launch velocities from spawn position.
- Remove gravity and decaying buoyancy from windy mode
- Apply constant per-particle lift plus shared global wind acceleration
- Align launch velocity with wind drift (up-right when wind blows right)
- Clamp downward velocity; turbulence affects lateral motion only
- Share hashSparkSeed01 between spark physics and turbulence
- Prewarm chunk mask worker during idle capture for chunks mode
- Clarify windy vs splat option docs; fix duplicate JSDoc typo
- Update deep-code-review skill example
Detect device pressure from hardware concurrency, device memory,
coarse pointer, and prefers-reduced-motion. Apply tier-based
particleStep, maxDuration, and maxChunkMaskSteps when resolving
options with a target element. Bump particle stride further when
the surface grid exceeds per-tier cell budgets.
Do not downgrade tier for coarse pointer alone; score only CPU and
memory. High tier skips surface particle-step bumping so modern
mobile gets the same visual settings as desktop.
- Use windy-specific travel bounds for canvas padding (~35% smaller buffer)
- Dirty-region canvas clears instead of full padded surface each frame
- Cache spark turbulence profile and lift factor on particles at spawn
- Skip physics for faded particles; pass resolved options into stepParticles
- Radial masks via CSS variables with radii write deduplication
- Skip redundant chunk mask DOM updates when frame index is unchanged
- Rely on scroll/resize listeners for overlay sync instead of every rAF
@mkayander
mkayander marked this pull request as ready for review August 2, 2026 19:48
@cursor

cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

…pled capture

- Prebuild chunk mask sequences during idle warm-up for chunks mode
- Reuse warm masks at dismiss when strategy matches (centerOut)
- Track active released particles to skip dead/unreleased in step/draw
- Use setTransform instead of save/restore per particle when rotating
- Downsample canvas before getImageData (~9x fewer pixels at step 3)
Use identical starting state and only vary turbulence seed/profile so
random launch velocities cannot make the separation threshold flaky.
Prefer the original radial burst over windy sparks for the banner
disintegrate animation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants