You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to animate the Canvas.Top or Canvas.Left attached properties #12301
difficulty/medium 🤔Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUIkind/bugSomething isn't workingproject/animations 🎡Categorizes an issue or PR as relevant to animations
@Youssef1313 Superficially looks the same but actually not. #8613 suggests that if you add
EnableDependentAnimation="true"
To the DoubleAnimation then the problem can be worked around.
This works for WASM but is not true for Android where the EnableDependentAnimation has no effect and it still does not work. Jury is still out on iOS.
Even for WASM, there is no suggestion under #8613 that anybody has raised a WinUI issue indicating that WinUI should require the EnableDependentAnimation property set to work, which makes be thing that if WinUI is correct the workaround is just covering up what is still an issue.
changed the title [-]Unable to animate the canvas top or left attached properties on WASM, Android, iOS[/-][+]Unable to animate the `Canvas.Top` or `Canvas.Left` attached properties[/+]on May 16, 2023
I assume that this flag has to be set to true to animate the Canvas.<X|Y> on Windows, and we should align Uno's behavior with Windows (even if currently we are not running animation independently of the UI thread on Skia and Wasm).
Gets or sets a value that declares whether animated properties that are considered dependent animations should be permitted to use this animation declaration.
@dr1rrb I absolutely agree that Uno's behavior should align with Windows, that was the point I was trying to make. The point is that Windows Does Not Require the EnableDependentAnimation flag set for the animation to run, so I was questioning why it was required in Uno.
A sequence of changes to the sample has enabled the iOS build to be investigated. The path has been shortened, the provisioning profile has been reset and changes from the latest templates incorporated.
The sample now shows that if EnableDependentAnimation="true" the iOS build executes as expected.
Therefore, in summary:
Windows OK
Android Fail
iOS OK with workaround
WASM OK with workaround
@dr1rrb I absolutely agree that Uno's behavior should align with Windows, that was the point I was trying to make. The point is that Windows Does Not Require the EnableDependentAnimation flag set for the animation to run, so I was questioning why it was required in Uno.
Indeed, animating (Canvas.<Top|Left>) is working on windows even if the EnableDependentAnimation is not set to true ... I was convinced that this should be considered as a dependent animation. And apparently when we implemented the animations in Uno we did the same mistake. This is definitely a bug in uno (and will probably require a refactor of the Canvas to make sure to be able to runs those animation independently).
For reference :
An animation is independent if it has any of these characteristics:
The Duration of the animation is 0 seconds (see Warning)
The animation targets UIElement.Opacity
The animation targets a sub-property value of these UIElement properties: Transform3D, RenderTransform, Projection, Clip
The animation targets Canvas.Left or Canvas.Top
The animation targets a Brush value and uses a SolidColorBrush, animating its Color
About the fact that the animation is not working on Android (even with the flag), this is strange and probably another bug ... do you have anything in the log?
BTW as a workaround (and a more performant approach for iOS and Android considering current support in uno), you should consider to use RenderTransform instead of Canvas.<Top|Left>.
@dr1rrb The suggestion to use a Translation Transform for the animation is a good one. This works absolutely fine on Windows and WASM, but has a minor issue on Android and a slightly bigger issue on iOS.
The sample has been updated to include the alternative animation. In the sample only the Translate.Y is animated.
On Android when the animation completes the Translate.X is set to 0 so the target object that has been moved shifts to the left of the screen.
On iOS the Translate.X is set to 0 as soon as the animation starts so the target object moves up the left-hand side of the screen.
Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported. - uno/working-with-animations.md at master · unoplatform/uno
difficulty/medium 🤔Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUIkind/bugSomething isn't workingproject/animations 🎡Categorizes an issue or PR as relevant to animations
Activity
Youssef1313 commentedon May 15, 2023
Looks like a dupe of #8613
BrianDT commentedon May 16, 2023
@Youssef1313 Superficially looks the same but actually not. #8613 suggests that if you add
EnableDependentAnimation="true"
To the DoubleAnimation then the problem can be worked around.
This works for WASM but is not true for Android where the EnableDependentAnimation has no effect and it still does not work. Jury is still out on iOS.
Even for WASM, there is no suggestion under #8613 that anybody has raised a WinUI issue indicating that WinUI should require the EnableDependentAnimation property set to work, which makes be thing that if WinUI is correct the workaround is just covering up what is still an issue.
[-]Unable to animate the canvas top or left attached properties on WASM, Android, iOS[/-][+]Unable to animate the `Canvas.Top` or `Canvas.Left` attached properties[/+]MartinZikmund commentedon May 16, 2023
Yes, will close #8613 in favor of this one, as it is more broad, affecting all targets
dr1rrb commentedon May 16, 2023
@BrianDT The
EnableDependentAnimationis a UWP/WInUI flag which isfalseby default and indicates if animations that are invalidating the layout (i.e. causing Measure/Arrange phases) are allowed or not (cf. https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.media.animation.doubleanimation.enabledependentanimation?view=winrt-22621#whats-considered-a-dependent-animation).I assume that this flag has to be set to
trueto animate theCanvas.<X|Y>on Windows, and we should align Uno's behavior with Windows (even if currently we are not running animation independently of the UI thread on Skia and Wasm).BrianDT commentedon May 19, 2023
@dr1rrb I absolutely agree that Uno's behavior should align with Windows, that was the point I was trying to make. The point is that Windows Does Not Require the EnableDependentAnimation flag set for the animation to run, so I was questioning why it was required in Uno.
BrianDT commentedon May 20, 2023
A sequence of changes to the sample has enabled the iOS build to be investigated. The path has been shortened, the provisioning profile has been reset and changes from the latest templates incorporated.
The sample now shows that if EnableDependentAnimation="true" the iOS build executes as expected.
Therefore, in summary:
Windows OK
Android Fail
iOS OK with workaround
WASM OK with workaround
dr1rrb commentedon May 25, 2023
Indeed, animating
(Canvas.<Top|Left>)is working on windows even if theEnableDependentAnimationis not set totrue... I was convinced that this should be considered as a dependent animation. And apparently when we implemented the animations in Uno we did the same mistake. This is definitely a bug in uno (and will probably require a refactor of theCanvasto make sure to be able to runs those animation independently).For reference :
https://learn.microsoft.com/en-us/windows/apps/design/motion/storyboarded-animations#dependent-and-independent-animations
About the fact that the animation is not working on Android (even with the flag), this is strange and probably another bug ... do you have anything in the log?
BTW as a workaround (and a more performant approach for iOS and Android considering current support in uno), you should consider to use
RenderTransforminstead ofCanvas.<Top|Left>.BrianDT commentedon May 26, 2023
@dr1rrb The suggestion to use a Translation Transform for the animation is a good one. This works absolutely fine on Windows and WASM, but has a minor issue on Android and a slightly bigger issue on iOS.
The sample has been updated to include the alternative animation. In the sample only the Translate.Y is animated.
On Android when the animation completes the Translate.X is set to 0 so the target object that has been moved shifts to the left of the screen.
On iOS the Translate.X is set to 0 as soon as the animation starts so the target object moves up the left-hand side of the screen.
dr1rrb commentedon Jun 5, 2023
@BrianDT Damn just realized that you are probably facing a known issue where animating 2 properties of the same object on those platforms causes some trouble https://github.com/unoplatform/uno/blob/master/doc/articles/features/working-with-animations.md#general-guidelines :/
The workaround is to have a layer for each animated value:
... which is incredibly ugly :/
You should upvote this #12530