On my local device, all my animations in all my MAUI Apps suddenly became instantaneous, I have no idea why. Everything was fine a couple of days ago.
The only thing I can think of is that I tried yesterday to play with the Particle.Maui nugget which didn’t work at first because I missed adding a .UseSkiaSharp() in the MauiProgram.cs. I had some weird messages from Visual Studio telling me that there was an issue with "Just My Code".
A simple animation does not even work : if I create a new Maui .NET 7 project and in the code of the dummy button add this code (the kind of code I used a lot for my buttons before) :
private void OnCounterClicked(object sender, EventArgs e)
{
// Animation
new Animation {
{ 0, 1, new Animation (v => CounterBtn.Scale = v, 1.0, 5.0) }
}.Commit(this, "TapScale", length: 300, easing: Easing.CubicOut);
}
On Window, it’s smooth as expected, yielding the expected result. On my local Android device, however, the 5 scale value is applied to full extend instantaneously. I tried with another animation type, for instance, the opacity, and the behaviour is the same : no animation, it just jumps to the final result.
This impacts all my applications I developed, even existing ones that were not deployed again since I spotted the issue.
I just tried with an Android Emulator with the same level as my local device (Android 13 – API33), everything’s fine, so it seems it is linked specifically to my device.
Is there a developper settings I played with that I cannot recall which magically stops the animation ?
2
Answers
Well, my phone was on battery saving mode which disables animations. Exiting Battery Saving Mode did the trick.
You might have disabled animations in the developer options of your Android device?
Another option is that battery saver is enabled, that can also disable animations.