Skip to content

Renderer fix stop lying#3

Merged
jona62 merged 2 commits intojona62:mainfrom
mac-studio-meme:renderer-fix-stop-lying
Apr 19, 2026
Merged

Renderer fix stop lying#3
jona62 merged 2 commits intojona62:mainfrom
mac-studio-meme:renderer-fix-stop-lying

Conversation

@jona62
Copy link
Copy Markdown
Owner

@jona62 jona62 commented Apr 19, 2026

No description provided.

jona62 added 2 commits April 19, 2026 21:22
animate(frames, 500) previously aborted the interpreter with
std::bad_variant_access because AnimateFunction assumed a MacInstance
and called std::get without checking. The documented invocation
animate(frames, Duration(500)) worked; anything else crashed the
process without a line number or message.

This commit rewrites AnimateFunction::call to:
- Accept a raw number as the duration (interpreted as milliseconds)
  in addition to a Duration instance
- Validate the array-of-memes argument instead of blindly std::get'ing it
- Throw std::runtime_error (which the interpreter wraps into a line-
  numbered RuntimeError) on any invalid type, instead of aborting
- Reject non-positive durations with a clear message

Adds two test files:
- tests/memes/animate_types.mac covers the happy path for both the
  number and Duration forms
- tests/memes/animate_bad_type.mac pins the error message for invalid
  arguments so this specific regression cannot silently come back

All 93 tests pass (91 existing + 2 new).
The parser has accepted 'bounce' as a transition easing keyword for
multiple versions, and it is listed in docs/reference/src/meme/gif.md
(previously) and the mac-language skill as a valid easing option.
However, MacTimeline::applyEasing had no 'bounce' case, so every
transition with 'bounce' silently rendered as linear.

Implements easeOutBounce using Robert Penner's canonical parameters
(n1 = 7.5625, d1 = 2.75), which is the same formulation used by
GSAP, d3-ease, and the CSS WG bounce reference. At the transition's
endpoint, the interpolation overshoots slightly, settles, overshoots
a smaller amount, and lands — producing the 'bouncing into place'
feel that the keyword advertises.

At t = 0.5 the new easing returns ~0.77 vs. linear's 0.5; at t = 0.75
it returns ~0.97 vs. 0.75. The difference is visible as the
transition appearing to land early and settle, instead of sliding in
at constant speed.

tests/timeline/bounce_easing.mac is added as a regression guard so
the parser/interpreter asymmetry cannot silently reappear.

All 94 tests pass (93 + 1 new).
@jona62 jona62 merged commit bf05e0e into jona62:main Apr 19, 2026
7 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.

1 participant