Skip to content

Fix time remapping with stretched precompositions - #427

Merged
xvrh merged 2 commits into
xvrh:masterfrom
snowyukitty:fix/time-remapped-precomp-stretch
Aug 21, 2026
Merged

xvrh merged 2 commits into
xvrh:masterfrom
snowyukitty:fix/time-remapped-precomp-stretch

Conversation

@snowyukitty

Copy link
Copy Markdown
Contributor

Addresses the reproducible blank-frame case in the original attachment to #323.
The two later reports in that thread do not include equivalent assets, so this
PR does not claim to resolve them.

Root cause

When a precomposition has time remapping, lottie-flutter converts the remapped
seconds into child-frame progress and then divides that already-remapped result
by the layer's sr. In the original animation, this second operation moves the
child outside its visible content and produces blank frames.

Time-remap output already identifies child time.
lottie-web
and both Lottie iOS rendering paths
(main-thread,
Core Animation)
use that output directly and apply start/stretch calculation only when
remapping is absent.

The Lottie specification
separately says stretch is applied first when both sr and tm are present.
This PR does not change the input used to sample an animated tm; it only
removes the output-side sr division.
Lottie Android
currently retains that division, so this is an intentional compatibility
difference supported by the original asset and the web/iOS behavior.

Summary

  • apply precomposition time stretch only when time remapping is absent
  • treat runtime ValueDelegate.timeRemap values as direct child time too,
    without applying the layer stretch to their output
  • add a focused pixel regression in which remapping selects child frame 50 and
    the old extra division incorrectly selects frame 25
  • retain a no-remap control that guards against accidentally removing ordinary
    time stretch

Testing

  • base plus the new test only: the remapped case failed with a transparent
    pixel instead of red; the no-remap control passed
  • flutter test test/time_remapping_test.dart: 2 passed
  • original issue asset at frame 130:
    • base: 0 non-transparent pixels
    • patched: 167,294 non-transparent pixels
  • additional checks passed:
    • flutter analyze
    • ten selected non-golden root test files: 464 tests
    • flutter test in example: 1 test
    • flutter pub run tool/prepare_submit.dart
    • flutter build web in example

The full root flutter test run on Windows completed with 990 passed and 30
failed. Every failure was a golden pixel comparison. The tracked golden inputs
with time remapping all have an effective sr of 1, so those failures do not
exercise the changed tm plus non-unit-sr path.

This repository documents golden generation and verification for pinned Apple
Silicon macOS runners. That canonical golden run was not available locally.

@codecov

codecov Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.96%. Comparing base (67da9c3) to head (c762835).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #427   +/-   ##
=======================================
  Coverage   83.95%   83.96%           
=======================================
  Files         163      163           
  Lines        6664     6672    +8     
=======================================
+ Hits         5595     5602    +7     
- Misses       1069     1070    +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Merge the two _timeRemapping checks into an if/else and record that the
time stretch is intentionally not applied to remapped child time.

Co-Authored-By: Claude Opus 5 <[email protected]>
@xvrh
xvrh merged commit 91ce46f into xvrh:master Aug 21, 2026
5 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