Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute multiple animation at same time

I would like to know how I do to run two animations at the same time

 public async void OnClicked2Async(object sender, EventArgs e)
    {

        btn_login.SetValue(IsVisibleProperty, true);
        await btn_login.TranslateTo(0, 175, 1000); 
        await btn_novaconta.TranslateTo(0, -60, 1000); 
    }

This is my code

like image 815
Maria Canelas Avatar asked Mar 07 '23 10:03

Maria Canelas


1 Answers

You can "group" animations by adding Animation instances to a parent/master Animation instance and then committing them:

var button1Anim = new Animation(_ => button1.TranslateTo(0, 175, 1000));
var button2Anim = new Animation(_ => button2.TranslateTo(0, 175, 1000));
var masterAnimation = new Animation
{
    { 0, 1, button1Anim },
    { 0, 1, button2Anim }
};
masterAnimation.Commit(this, "MyAnim");

Re: Custom Animations

like image 190
SushiHangover Avatar answered Mar 16 '23 12:03

SushiHangover