Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using TranslateTo over Xamarin.Forms.Core.Animation for animation?

Currently I am working to make our application very responsive to the user, While working on that I came across the below code for showing indefinite progress bar to user

Task.Run(async () => {
    while (!_progressCts.IsCancellationRequested)
    {
        await (box as BoxView).TranslateTo(this.Width, 0, 1200);
        await (box as BoxView).TranslateTo(-this.Width, 0, 0);
    }
}, _progressCts.Token); 

This animation looks simple But From the documents I came to know that there is a separate class known as 'Xamarin.Forms.Core.Animation' for handling animations. My question is which one is better in terms of making UI responsive to the user.

The above code is to show an indefinite progress bar on top of a ListView But it is not at all disturbing the scrolling experience of the ListView.

like image 281
vignesh kumar Avatar asked Nov 29 '25 13:11

vignesh kumar


1 Answers

TranslateTo is a specific implementation that uses the Xamarin.Forms.Core.Animation resources. Both are responsive to the user, they don't freeze the app flow. Actually, the second one is doing the job in a separated thread, and the SO handles quick and smoothly the interface changes.

Look my answer here, it shows an alternative implementation to change the button background color using the same approach.

like image 136
GKMoreira Avatar answered Dec 02 '25 02:12

GKMoreira



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!