You can create a basic animation using the ViewExtensions
class. Here’s an example of a simple fade-in animation for a Label
:
XAML
<Label x:Name="animatedLabel" Text="Hello, .NET MAUI!" Opacity="0" />
<Button Text="Animate" Clicked="OnAnimateClicked" WidthRequest="200" />
C#
async void OnAnimateClicked(object sender, EventArgs e)
{
//whenever the button is clicked
await BasicAnimation(animatedLabel);
}
async Task BasicAnimation(View view)
{
await view.FadeTo(1, 1000);
}
Share with