Skip to content

refactor(shader-transitions): extract DEFAULT_DURATION and DEFAULT_EASE constants#367

Merged
vanceingalls merged 2 commits intomainfrom
vance/transition-defaults
Apr 23, 2026
Merged

refactor(shader-transitions): extract DEFAULT_DURATION and DEFAULT_EASE constants#367
vanceingalls merged 2 commits intomainfrom
vance/transition-defaults

Conversation

@vanceingalls
Copy link
Copy Markdown
Collaborator

@vanceingalls vanceingalls commented Apr 21, 2026

Summary

Extract DEFAULT_DURATION = 0.7 and DEFAULT_EASE = "power2.inOut" as shared constants in hyper-shader.ts and apply them at all three fallback sites (metadata write, browser/render mode, engine mode).

Why

Chunk 2 of plans/hdr-followups.md. The three fallback sites had drifted apart: the metadata path used 1s / "none" while the actual rendering used 0.7s / "power2.inOut". A transition that omitted duration/ease would render at 0.7 s but tell the producer it was 1 s, throwing off the producer's compositing window planning and producing a visible ~0.3 s brightness dropout.

This is a small, high-value correctness fix that runs before the larger Chunk 1 / Chunk 4 work.

What changed

  • New module-level DEFAULT_DURATION and DEFAULT_EASE constants in packages/shader-transitions/src/hyper-shader.ts.
  • All three fallback call sites (metadata, browser, engine) now use the constants.
  • Explicit ease: "none" on the timeline-length anchor tweens elsewhere in the file is intentional (those are linear interpolators driving the shader's progress uniform) and is left unchanged.

Test plan

  • Render a composition with a transition that omits duration and ease — no brightness dip in the last ~0.3 s of the transition.
  • Preview (browser mode) and render (engine mode) produce matching blending curves.
  • Render with explicit duration: 1.5 still works (constants are fallbacks only).

Stack

Chunk 2 of plans/hdr-followups.md. Lands ahead of Chunk 1 (opacity) per the suggested merge order.

Copy link
Copy Markdown
Collaborator Author

vanceingalls commented Apr 21, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

This was referenced Apr 21, 2026
@vanceingalls vanceingalls marked this pull request as ready for review April 21, 2026 20:57
@vanceingalls vanceingalls force-pushed the vance/transition-defaults branch 2 times, most recently from 9cc8938 to c4de50b Compare April 22, 2026 02:03
Copy link
Copy Markdown
Collaborator

@jrusso1020 jrusso1020 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup that surfaces a real bug. Before this PR the meta-write path used duration ?? 1 + ease ?? "none" while the render-mode and engine-mode paths used duration ?? 0.7 + ease ?? "power2.inOut". Concretely: a transition declared without explicit duration would play for 0.7s with power2.inOut but be reported in the __hf.transitions metadata as 1s with "none" — so the producer's HDR compositor would plan a 1.0s compositing window while the actual shader animation only ran 0.7s. The difference gets papered over in most compositions (transitions usually declare both fields) but any default-relying transition would have misaligned encoder buffers against the visual output.

Extracting DEFAULT_DURATION / DEFAULT_EASE to module-scope constants and using them at all three sites both fixes the inconsistency and prevents it from drifting back. Approved.

Rames Jusso

@vanceingalls vanceingalls force-pushed the vance/transition-defaults branch from c4de50b to 0eed2ab Compare April 22, 2026 04:43
@vanceingalls vanceingalls force-pushed the vance/transition-defaults branch from 0eed2ab to d0aa979 Compare April 22, 2026 05:09
@vanceingalls
Copy link
Copy Markdown
Collaborator Author

Confirmed — the analysis is right. The pre-PR mismatch (1.0s + "none" in the meta path vs. 0.7s + "power2.inOut" in the shader path) was exactly the kind of latent encoder/visual desync that only surfaces when a composition omits both duration and ease, which is rare enough in production that it never tripped a regression test. Centralizing on DEFAULT_DURATION / DEFAULT_EASE collapses all three sites onto a single source of truth so a future tweak to defaults can't reopen the gap. No follow-ups required.

@vanceingalls vanceingalls force-pushed the vance/transition-defaults branch from e039969 to acc87c8 Compare April 22, 2026 17:19
@vanceingalls vanceingalls force-pushed the vance/type-safety branch 2 times, most recently from edea17b to fb5966b Compare April 22, 2026 17:30
@vanceingalls vanceingalls force-pushed the vance/transition-defaults branch 2 times, most recently from 8f5f477 to e56820c Compare April 22, 2026 18:50
@vanceingalls vanceingalls force-pushed the vance/type-safety branch 2 times, most recently from 903dea1 to 949e87b Compare April 22, 2026 18:59
@vanceingalls vanceingalls force-pushed the vance/transition-defaults branch from e56820c to 35d6cb8 Compare April 22, 2026 18:59
@vanceingalls vanceingalls force-pushed the vance/transition-defaults branch from 35d6cb8 to 03227b5 Compare April 22, 2026 19:34
@vanceingalls vanceingalls force-pushed the vance/transition-defaults branch 2 times, most recently from 24ba6ee to 7ccb234 Compare April 22, 2026 20:48
@vanceingalls vanceingalls force-pushed the vance/type-safety branch 2 times, most recently from 390db46 to 49c7c80 Compare April 22, 2026 22:13
@vanceingalls vanceingalls force-pushed the vance/transition-defaults branch from 7ccb234 to 0a77088 Compare April 22, 2026 22:13
@vanceingalls vanceingalls force-pushed the vance/transition-defaults branch 2 times, most recently from f25df83 to 680c322 Compare April 22, 2026 23:26
@vanceingalls vanceingalls changed the base branch from vance/type-safety to graphite-base/367 April 22, 2026 23:56
…SE constants

The three fallback sites in hyper-shader.ts (metadata write, browser/render
mode, and engine mode) had drifted apart: the metadata path used 1s/'none'
while the actual rendering used 0.7s/'power2.inOut'. This meant a transition
without an explicit duration/ease would render at 0.7s but tell the engine
it was 1s, throwing off the producer's compositing window planning.

Extract DEFAULT_DURATION (0.7) and DEFAULT_EASE ('power2.inOut') as
module-level constants and use them at all three sites so a missing
duration/ease produces identical behavior in preview, the engine's
deterministic seek path, and the metadata the producer reads.

The explicit `ease: 'none'` on the timeline-length anchor tweens elsewhere
in the file is intentional (those are linear interpolators driving the
shader's progress uniform) and is left unchanged.
@vanceingalls vanceingalls force-pushed the vance/transition-defaults branch 2 times, most recently from d095760 to 95303f3 Compare April 22, 2026 23:57
@graphite-app graphite-app Bot changed the base branch from graphite-base/367 to main April 22, 2026 23:57
@vanceingalls vanceingalls force-pushed the vance/transition-defaults branch from 95303f3 to d095760 Compare April 22, 2026 23:57
@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented Apr 22, 2026

Merge activity

  • Apr 22, 11:58 PM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.
  • Apr 23, 12:02 AM UTC: @vanceingalls merged this pull request with Graphite.

@vanceingalls vanceingalls merged commit 9512744 into main Apr 23, 2026
27 checks passed
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