Skip to content

[Feature] Integration with UICompositionAnimations #3108

Closed
@Sergio0694

Description

@Sergio0694

Describe the problem this feature would solve

Hi everyone, I'm opening this issue following a conversation with @michael-hawker over at the UWP Community Discord server about integrating my UICompositionAnimations library into the Windows Community Toolkit. I've proceeded to do an initial refactoring of my entirely library to split it into three different, self-contained projects (now referred to as FluentExtensions):

  • FluentExtensions.UI, which only contains some XAML attached properties, some markup extensions and some UI dispatch helpers.
  • FluentExtensions.UI.Animations, which contains all my XAML/Composition animation extensions (screen here), and additional helpers to setup things like expression animations on a ScrollViewer.
  • FluentExtensions.UI.Brushes, which contains my custom pipeline builder class to create Win2D/Composition effects, along with a set of APIs that allow devs to easily create custom effects pipelines directly from XAML (screen here), to use them as brushes.

Now, over time many of my helpers have been added in some equivalent form to the Windows Community Toolkit, in particular the animation extensions, which overlap almost entirely with equivalent APIs from the Windows Community Toolkit. On the other hand, stuff like my pipeline XAML effects are exclusive to my library and are not available in any form with the Windows Community Toolkit, and I think they'd be a great addition to it that other developers could use as well.

Considering this, my idea would be to fully integrate my library into the Windows Community Toolkit, following three main principles:

  • After the integration is complete, it should be possible for apps currently using UICompositionAnimations (eg. myTube!, Legere, OneLocker, Brainf*ck#, SoundByte, Quarrel) to ditch it entirely, and switch to the Windows Community Toolkit without loss of functionality.

  • Wherever the Windows Community Toolkit offers equivalent APIs, those APIs from the UICompositionAnimations library should be ditched.

  • If for a given set of equivalent APIs, the UICompositionAnimations library offers additional features not directly available from the toolkit, those should be ported over to enrich the API set of the Windows Community Toolkit, if possible.

This would make new useful APIs available for a larger number of developers too, and expand the feature set of the Windows Community Toolkit in the process. Also, it would allow all the apps using UICompositionAnimations to ditch it and just rely on the Windows Community Toolkit going forward.

The point of this issue is mainly to discuss specific features from UICompositionAnimations and how to properly integrate them into this repository, offer suggestions on how to achieve equivalent results only using currently existing APIs from the toolkit, if possible, and to track all the individual PRs needed to port the features from UICompositionAnimations to the Windows Community Toolkit.

Describe the solution

I've made a list of all the individual things I'd like to port to the Windows Community Toolkit, starting from the simplest things to port. For each item, there's a small description and a link to the related pull request, if existing. Also, for some items, some additional discussion will be needed. Eg. I'll create a draft PR for the brushes item, and we can see there how to better include them in the toolkit. Similarly, I will need some help from people familiar with the toolkit to see how to properly handle the animations part.

Feature Description Dependencies PR
DispatcherExtensions A class that provides helpers/extensions to run delegates on the UI thread SDK 10240 #3119
ClipHelper A XAML attached property that uses a composition InsetClip to clip the rendering coming from inside a given UIElement SDK 16299 #3111
FontIconExtension A XAML markup extension that creates a FontIcon from a string representing a Segoe MDL2 icon, resulting in much cleaner code (see here) SDK 16299 #3110
ScrollViewerExtensions A class with two extension methods for the ScrollViewer class, to easily start an expression animation binding the scrolling to offset of a target UIElement SDK 16299 #3220
Animations Extension methods to create/run/await animations that can run either on the XAML or Composition layer. Composition translation animation is available too. These adapt automatically depending on the target layer (eg. if you run a translation animation with composition, the lib will use those APIs, instead if you're targeting XAML it'll automatically create a render transform for you and animate that instead. Or, the size animation targets Visual.Size with composition, or the actual element height/width (with dependent animations) if you choose XAML) SDK 16299 #3639
Brushes The C# pipeline builder class and helper methods to load Win2D textures, and classes to create and use brushes from XAML. SDK 17134, Win2D #3112

Thanks in advance to everyone willing to help out, give feedbacks or contribute to the discussion on how to properly do this and organize work on this going forward! 😄

I'll get started on the first PRs in the meantime, looking forward to hearing from you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature request 📬A request for new changes to improve functionality

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions