Skip to content

fix: hide zero-opacity elements at runtime to reduce GPU layers#16

Merged
bertpl merged 1 commit intomainfrom
fix/0-1-4-05-hide-zero-opacity-elements
May 7, 2026
Merged

fix: hide zero-opacity elements at runtime to reduce GPU layers#16
bertpl merged 1 commit intomainfrom
fix/0-1-4-05-hide-zero-opacity-elements

Conversation

@bertpl
Copy link
Copy Markdown
Owner

@bertpl bertpl commented May 7, 2026

Summary

  • Renderer emits data-opacity-keyframes attribute on elements with animated opacity.
  • New ElementVisibility class evaluates the piecewise-linear opacity function on each scroll tick and toggles visibility: hidden when opacity drops below threshold (0.001).
  • Only writes to DOM at threshold crossings, not every tick.
  • Particularly impactful for scrollimation slides with many stacked images where only 2-3 are visible at any scroll position.

Test plan

  • 646 Python + 103 JS tests pass (including new evaluatePiecewiseLinear tests)
  • Built worked example - elements at opacity 0 have visibility:hidden in DevTools
  • Scroll through scrollimation slides - transitions remain smooth

Generated with Claude Code

Renderer emits data-opacity-keyframes on elements with animated opacity. New ElementVisibility class evaluates the piecewise-linear function on each scroll tick and toggles visibility:hidden when opacity drops below threshold.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bertpl bertpl merged commit e339b49 into main May 7, 2026
9 checks passed
@bertpl bertpl deleted the fix/0-1-4-05-hide-zero-opacity-elements branch May 7, 2026 07:01
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.

1 participant