gpt4 book ai didi

android - 如何连续启动AnimatorSet?

转载 作者:搜寻专家 更新时间:2023-11-01 09:32:22 24 4
gpt4 key购买 nike

我想在一个 View 上运行多个 AnimatorSet。 AnimatorSet 应该一个接一个地连续运行。我想在不使用处理程序进行时间延迟的情况下执行此操作。我该怎么做?

最佳答案

在您的代码中试试这个。

AnimatorSet bouncer = new AnimatorSet();
ObjectAnimator anim = ObjectAnimator.ofFloat(mTextView, "rotationX", 0f, 180f);
anim.setDuration(2000);
ObjectAnimator anim2 = ObjectAnimator.ofFloat(mTextView, "rotationX", 180f, 0f);
anim2.setDuration(2000);
ObjectAnimator anim3 = ObjectAnimator.ofFloat(mTextView, "rotationY", 0f, 180f);
anim3.setDuration(2000);
ObjectAnimator anim4 = ObjectAnimator.ofFloat(mTextView, "rotationY", 180f, 0f);
anim4.setDuration(2000);

bouncer.playSequentially(anim, anim2, anim3, anim4);
bouncer.start();

注意

方法:

  1. 播放(动画师动画);

    play (Animator anim):  // add an animation and return AnimatorSet.Builder
  2. 顺序播放(列表项);

    playSequentially (List items):  // add a set of animations, play sequentially, and play them one by one
  3. playSequentially(动画师...项目);

    playSequentially (Animator... Items):   // add a set of animations, play sequentially, and play them one by one
  4. 一起玩(收藏品);

    playTogether (Collection items):   // add a set of animations, played sequentially, and played together
  5. playTogether(动画师...项目);

     playTogether (Animator... Items):   // add a set of animations, play sequentially, and play together

关于android - 如何连续启动AnimatorSet?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46048176/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com