feat(hdr): GSAP transforms and border-radius masks on HDR video#290
Open
vanceingalls wants to merge 1 commit intofeat/hdr-phase-2from
Open
feat(hdr): GSAP transforms and border-radius masks on HDR video#290vanceingalls wants to merge 1 commit intofeat/hdr-phase-2from
vanceingalls wants to merge 1 commit intofeat/hdr-phase-2from
Conversation
This was referenced Apr 16, 2026
Collaborator
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
a502eb3 to
8b9096f
Compare
1ea1b2b to
528ea17
Compare
3e571ca to
c8cb0d0
Compare
Affine blit with bilinear interpolation for GSAP-animated HDR video. Accumulated viewport matrix via DOMMatrix chain with transform-origin handling. Effective opacity ancestor walk. Rounded-rectangle mask with anti-aliased corners and percentage resolution. Layout dimensions for extraction (unaffected by CSS transforms). SDR visibility fixes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2837b2c to
eb10879
Compare
20ca4e3 to
dc89f54
Compare
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.

Summary
HDR video elements with GSAP animations (position, scale, rotation, opacity) and CSS border-radius rendered without any transforms applied — the video just sat at (0,0) full-size. This PR adds affine transform support and rounded-corner masking for natively-composited HDR video.
What it does
Affine blit with bilinear interpolation:
blitRgb48leAffine()— Takes a 4x4 DOMMatrix and maps each destination pixel back to source coordinates via the inverse transform. Bilinear interpolation between the 4 nearest source pixels produces smooth edges under rotation and non-integer scaling. Optional opacity and border-radius parameters.parseTransformMatrix()— Parses CSSmatrix(a,b,c,d,e,f)strings into[a,b,c,d,e,f]tuples.Accumulated viewport matrix:
getViewportMatrix()— Walks theoffsetParentchain from element to viewport, accumulating position offsets and CSS transforms at each level. Correctly handlestransform-originusing the CSS sandwich:translate(origin) × M × translate(-origin). This is critical because GSAP animates transforms on wrapper divs, not directly on the video element.Effective opacity:
getEffectiveOpacity()— Multiplies opacity values walking up the ancestor chain. UsesNumber.isNaN()(not|| 1) so opacity:0 isn't incorrectly treated as 1.Border-radius masks:
roundedRectAlpha()— Per-pixel anti-aliased rounded-rectangle mask with support for independent corner radii.getEffectiveBorderRadius()— Walks ancestors foroverflow:hidden+ border-radius. Resolves percentage values (e.g.,50%for circles) viaoffsetWidth/offsetHeight.Layout dimensions for extraction:
offsetWidth/offsetHeight(unaffected by CSS transforms) instead ofgetBoundingClientRect()(which returns the transformed bounding box and wobbles under rotation).Files changed
packages/engine/src/utils/alphaBlit.tsblitRgb48leAffine(),parseTransformMatrix(),roundedRectAlpha(),cornerAlpha()packages/engine/src/services/videoFrameInjector.tsgetViewportMatrix(),getEffectiveOpacity(),getEffectiveBorderRadius(),layoutWidth/layoutHeightonElementStackingInfopackages/producer/src/services/renderOrchestrator.tsHow to test
Render a composition with an HDR video that has GSAP scale + rotation animation and a
border-radius: 50%wrapper (circle mask). The video should rotate smoothly with round edges — no wobble, no sharp corners.Stack position
5 of 6 — Stacked on #289 (z-ordered layers). Adds transform and masking support to the HDR blit that the layer compositor uses.
🤖 Generated with Claude Code