Skip to content

TranslateTo/RotationY Causes Artefacts on Windows #13438

Open
@JohnHunterACS

Description

@JohnHunterACS

Description

After animating the location of the element so that it moves up the screen and then starting a repeating animation to rotate the element, the vertical positioning of the element glitches every few seconds so that it jumps up the screen before returning to its correct position.

Steps to Reproduce

  1. Create a File > New .NET MAUI App
  2. Replace MainPage.xaml content with the following.
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="ManuAnimationsBug.MainPage"
             Loaded="ContentPage_Loaded">

    <VerticalStackLayout  VerticalOptions="CenterAndExpand">

        <Image
                x:Name="BotLogo"
                Source="dotnet_bot.png"
                SemanticProperties.Description="Cute dot net bot waving hi to you!"
                HeightRequest="200"
                WidthRequest="200"
                VerticalOptions="CenterAndExpand"
                HorizontalOptions="CenterAndExpand" />

    </VerticalStackLayout>

</ContentPage>
  1. Replace the MainPage.xaml.cs with the following...
namespace ManuAnimationsBug;

public partial class MainPage : ContentPage
{
    private readonly Task _delay;
    private Animation _logoRotation;

    public MainPage()
	{
		InitializeComponent();
		_delay = Task.Delay(2_000);
	}

    private async void ContentPage_Loaded(object sender, EventArgs e)
    {
        await _delay;
        await AnimateSplashLogoAsync();
    }

    private async Task AnimateSplashLogoAsync()
    {
        await BotLogo.TranslateTo(0, -200, length: 1_000);
        RotateLogo();
    }

    private void RotateLogo()
    {
        _logoRotation = new Animation(v => BotLogo.RotationY = v, 0, 360);
        _logoRotation.Commit(this, "ChildAnimations", 16, 2000, null, repeat: () => true);
    }
}


  1. Run the app

Expected outcome: logo moves to the top of the screen and animates
Actual outcome: logo moves to the top of the screen then glitches location as it animates

Link to public reproduction project repository

https://dev.azure.com/JohnHunter0895/_git/MauiAnimationBug

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

windows10.0.19041.0

Did you find any workaround?

No workaround

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-animationAnimation, Transitions, Transformsplatform/windows 🪟s/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions