Disable Animations processing when Visual's not visible redux by jmacato · Pull Request #20820 · AvaloniaUI/Avalonia (original) (raw)

Pull request overview

This PR aims to stop spending time advancing keyframe animations when the target Visual isn’t effectively visible, and to end animations when a visual is detached from the visual tree.

Changes:

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tests/Avalonia.Base.UnitTests/Animation/TestClock.cs Switches to multi-subscriber clock to support additional clock subscriptions introduced by animation visibility monitoring.
tests/Avalonia.Base.UnitTests/Animation/AnimationIterationTests.cs Adds tests for pausing on IsEffectivelyVisible == false and completing on detach from visual tree.
src/Avalonia.Base/Animation/Animators/TransformAnimator.cs Refactors transform-property animation application to use a subject/binding approach.
src/Avalonia.Base/Animation/AnimationInstance`1.cs Adds visibility-based pause/resume and detach-based completion behavior for animations targeting Visuals.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.