Repository navigation
Conversation
OnlyIfVisible paused properties applied directly to a Visual, but transform setters continued advancing because their AnimationInstance targeted a child Transform. This left scale and opacity out of phase after visibility was restored.\n\nCarry the owning visual separately from the property target so transform instances observe the same visibility and detachment lifecycle. Cover the pause and resume timeline with a regression test.
|
You can test this PR using the following package version. |
|
You can test this PR using the following package version. |
…ion-visibility # Conflicts: # src/Avalonia.Base/Animation/AnimationInstance`1.cs
|
You can test this PR using the following package version. |
MrJul
enabled auto-merge
August 24, 2026 10:27
MrJul
added a commit
to MrJul/Avalonia
that referenced
this pull request
Sep 2, 2026
…UI#21896) OnlyIfVisible paused properties applied directly to a Visual, but transform setters continued advancing because their AnimationInstance targeted a child Transform. This left scale and opacity out of phase after visibility was restored.\n\nCarry the owning visual separately from the property target so transform instances observe the same visibility and detachment lifecycle. Cover the pause and resume timeline with a regression test. Co-authored-by: Julien Lebosquain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
Fixes transform properties in
OnlyIfVisiblekeyframe animations continuing to advance while their owningVisualis hidden. This could leave transform and visual properties, such asScaleXandOpacity, out of phase when the control became visible again.What is the current behavior?
Transform setters store their animated value on a child
Transform. The visibility pause logic inspected that property target, which is not aVisual, so transform animations did not observe the owning control's visibility changes. Properties animated directly on the visual paused as expected.What is the updated/expected behavior with this PR?
Transform and direct visual properties now pause and resume on the same timeline when
PlaybackBehaviorisOnlyIfVisible.A regression test covers an infinite
ScaleXandOpacityanimation across a hide and show cycle. Before the fix,ScaleXadvanced from1to1.75while hidden.Validation:
AnimationIterationTestspassed.Avalonia.Base.UnitTests: 3,021 total, 3,009 passed, 12 skipped, 0 failed.Avalonia.BaseRelease build completed with 0 warnings and 0 errors.How was the solution implemented (if it's not obvious)?
AnimationInstancenow keeps the visual lifecycle target separate from the animated property target. Normal animations use the same object for both.TransformAnimatorcontinues binding values to the childTransform, but passes the owningVisualfor visibility and detach lifecycle handling.Checklist
Breaking changes
None.
Obsoletions / Deprecations
None.
Fixed issues
Fixes #21459