

Here is an example where we use this functionality, together with explicit keyframes to have more fine-grained control over the animation to run: It is also possible to explicitly target the XAML layer too though, which can enable things such as animating the color of a brush used to display some text in a Button.

īy default, animations target the Composition layer as it provides the best performance possible. The animation is also directly attached to the Button, so we can start it directly by calling the Start() method, without the need to specify the target element to animate.
#Animation composer registration key code
In this case we are using x:Name so that we can reference it in code behind to start it when the button is clicked. Here is how a simple animation can be declared in XAML. These two types of animation nodes implement several interfaces (such as ITimeline and IActivity) which make this system extremely customizable and extensible for users as well for their own scenarios.
#Animation composer registration key update
to update a visual state while an animation is running). Activities on the other hand are a way to interleave an animation schedule with all sorts of custom logic, such as triggering other animations or running arbitrary code (eg.Each animation type also supports using keyframes in addition to just defining the starting and final values. They are available as both "default" animations that are ready to use and "custom" animations that can be fully configured. Animation types are a mapping in XAML for the various APIs exposed by the AnimationBuilder class.Platform APIs: AnimationSet, AnimationBuilder, Explicit, ITimeline, IActivity, AnimationScope, AnimationStartedTriggerBehavior, AnimationCompletedTriggerBehavior, StartAnimationAction, StopAnimationAction How it worksĮach set can contain any number of animation scopes and individual nodes, which can be either animations or "activities": It can also be directly attached to a parent UI element, via the Explicit.Animations attached property. in a ResourceDictionary) and then be used to start animation schedules on multiple UI elements. Like AnimationBuilder, AnimationSet instances can also be shared (e.g. It can contain any number of animations or activities, exposes methods to start and stop an animation, and events to be notified when an animation has started or is completed. The AnimationSet type represents an animation schedule, effectively representing an AnimationBuilder instance via XAML code.
