

This ensures that each animation will always be a 360 degrees rotation from the starting position.
GODOCS MAUI PLUS
The RelRotateTo method obtains the current Rotation property value of the element for the start of the animation, and then rotates from that value to the value plus its first argument (360). In this example, an Image instance is rotated 360 degrees from its starting position over 2 seconds (2000 milliseconds). Relative rotation is performed with the RelRotateTo method, which progressively changes the Rotation property of an element: await image.RelRotateTo(360, 2000) In addition to the RotateTo method, there are also RotateXTo and RotateYTo methods that animate the RotationX and RotationY properties, respectively. This ensures that the Rotation property doesn't remain at 360 after the animation concludes, which would prevent additional rotations. Once the animation is complete, the image's Rotation property is reset to 0. The RotateTo method obtains the current Rotation property value of the element for the start of the animation, and then rotates from that value to its first argument (360). In this example, an Image instance is rotated up to 360 degrees over 2 seconds (2000 milliseconds). Rotation is performed with the RotateTo method, which progressively changes the Rotation property of an element: await image.RotateTo(360, 2000) Single animationsĮach extension method in the ViewExtensions class implements a single animation operation that progressively changes a property from one value to another value over a period of time. For more information, see Composite animations. This operation can be taken advantage of when creating composite animations. In this scenario, the animation extension methods will quickly return after initiating the animation, with the animation occurring in the background. If there's a requirement to let an animation complete in the background, then the await operator can be omitted. For more information, see Compound animations. Therefore, when animation operations are combined with the await operator it becomes possible to create sequential animations with subsequent animation methods executing after the previous method has completed. The return value is false if the animation completes, and true if the animation is cancelled. The animation extension methods in the ViewExtensions class are all asynchronous and return a Task object.

However, this method is intended to be used by layouts to animate transitions between layout states that contain size and position changes. The ViewExtensions class also provides a LayoutTo extension method. However, a duration for each animation can be specified when creating the animation. TranslateTo animates the TranslationX and TranslationY properties of a VisualElement.īy default, each animation will take 250 milliseconds.ScaleYTo animates the ScaleY property of a VisualElement.ScaleXTo animates the ScaleX property of a VisualElement.ScaleTo animates the Scale property of a VisualElement.RotateYTo animates the RotationY property of a VisualElement.RotateXTo animates the RotationX property of a VisualElement.

RelRotateTo applies an animated incremental increase or decrease to the Rotation property of a VisualElement.RotateTo animates the Rotation property of a VisualElement.RelScaleTo applies an animated incremental increase or decrease to the Scale property of a VisualElement.FadeTo animates the Opacity property of a VisualElement.CancelAnimations cancels any animations.NET Multi-platform App UI (.NET MAUI) animation classes target different properties of visual elements, with a typical basic animation progressively changing a property from one value to another over a period of time.īasic animations can be created with extension methods provided by the ViewExtensions class, in the namespace, which operate on VisualElement objects:
