Skip to content

🐛 Clear the transform effect's scratch canvas between frames - #363

Merged
clabe45 merged 1 commit into
etro-js:masterfrom
suhailopensource:fix/286-transform-trail
Aug 7, 2026
Merged

clabe45 merged 1 commit into
etro-js:masterfrom
suhailopensource:fix/286-transform-trail

Conversation

@suhailopensource

Copy link
Copy Markdown
Contributor

Fixes #286.

The scratch canvas the effect composites through is only reset when the target is resized, so on a steady-size movie it's never cleared. drawImage composites source-over, so the previous transformed frame survives wherever the current one is transparent and gets copied back onto the target — the trail @keiddzz reported.

This clears the scratch canvas before compositing, resetting the transform to identity first so the clear isn't mapped through the last frame's matrix. That reset replaces the one that was at the end of apply, whose arguments were in the wrong order: setTransform(1, 0, 0, 0, 1, 0) has d = 0, so it was degenerate rather than identity.

Added a unit test that applies the effect over two frames and asserts the old position is empty — it fails on master and passes here. I also reproduced @keiddzz's setup end to end (an Image layer with a keyframed matrix, rendered across four frames) and confirmed the trail is gone. Existing unit, smoke and integration suites all pass.

The scratch canvas is only reset when the target is resized, so on a steady-size movie it is never cleared. drawImage composites source-over, so the previous transformed frame survived wherever the current one was transparent and was copied back onto the target, leaving a trail behind a moving layer.

Clear it before compositing, resetting the transform to identity first so the clear is not mapped through the last frame's matrix. That reset replaces the one at the end of apply, whose arguments were in the wrong order: setTransform(1, 0, 0, 0, 1, 0) has d = 0, so it was degenerate rather than identity.
@clabe45
clabe45 merged commit 26aa5bd into etro-js:master Aug 7, 2026
3 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.

Transform effect leaves a trail when using the image layer.

2 participants