unoplatform / uno

Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported.
https://platform.uno
Apache License 2.0
8.76k stars 705 forks source link

Ability to re-use an animation on multiple controls #635

Open dr1rrb opened 5 years ago

dr1rrb commented 5 years ago

I'm submitting a...

Current behavior

Animations are tightly coupled with the control (or RenderTransform) that they are animating They cannot be declared in resources and re-used on multiple controls as they can be on Windows.

Expected behavior

A transform can be declared in resources, re-used as RenderTranform on multiple controls across an application, and then animated.

Environment

Nuget Package: Uno.UI Package Version(s): irrelevant Affected platform(s):

Visual Studio: irrelevant Relevant plugins: none

ramezgerges commented 1 year ago

This is me reporting my findings with the way animations interact on Windows when they affect shared Transforms and the many cases around the idea of animations and transforms being used for multiple targets. This was initially noticed as one of many CommandBar problems being solved in #13214. From here on out, I will refer to cases of a transform being used multiple times as SharedTransform. Similarly, I will name a single animation that's used for different elements, SharedAnimation.

Code for all cases can be found at https://gist.github.com/ramezgerges/909df0982622c021caf0d5c62f46e631

Some general related findings

All in all, it seems that the most interesting observation is that StaticResource transforms are cloned at the point of running an animation, but not before.

Gist
case1.1.md
GitHub Gist: instantly share code, notes, and snippets.