播放动画倒放。

huangapple go评论56阅读模式
英文:

Play animation backwards

问题

我在我的AnimationView上添加了点击事件,我试图在第一次点击时播放动画,在第二次点击时倒放动画。

要实现这个效果,最好的方式是什么?

Com.Airbnb.Xamarin.Forms.Lottie 4.1.0
Xamarin.Forms 5.0.0.2291

英文:

I added click event on my AnimationView and I'm trying to play the animation with the first click and play the animation backwards with the second one.

Which would be the best way to achieve it?

Com.Airbnb.Xamarin.Forms.Lottie 4.1.0
Xamarin.Forms 5.0.0.2291

答案1

得分: 0

正如Andrew建议的那样,诀窍是调整正负动画速度。

if (!animationShowing)
{
   this.menuView.Speed = 3;
   this.menuView.PlayMinAndMaxFrame(0, 20);
}

else
{
   this.menuView.Speed = -3;
   this.menuView.PlayAnimation();
}
英文:

As Andrew suggested, the trick was to play with positive/negative animation speed.

if (!animationShowing)
{
   this.menuView.Speed = 3;
   this.menuView.PlayMinAndMaxFrame(0, 20);
}

else
{
   this.menuView.Speed = -3;
   this.menuView.PlayAnimation();
}

huangapple
  • 本文由 发表于 2023年2月27日 18:37:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/75579380.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定