gpt4 book ai didi

android - Ola 跳针动画

转载 作者:太空狗 更新时间:2023-10-29 16:11:13 24 4
gpt4 key购买 nike

我正在尝试创建像 Ola Cabs India 闪屏这样的动画,其中标记针不断跳跃。我可以通过到处搜索来创建弹跳动画。

Android Scale Animation with bounce interpolator

但无法重新创建 Ola 动画。任何人都可以提供一些指导方针。

最佳答案

最后我找到了满足我要求的解决方案。将其发布给寻找类似解决方案的任何人。

TranslateAnimation transAnim = new TranslateAnimation(0, 0,-getDisplayHeight()/10,0);
transAnim.setStartOffset(500);
transAnim.setDuration(3000);
transAnim.setRepeatCount(-1);
transAnim.setRepeatMode(Animation.REVERSE);
transAnim.setInterpolator(new BounceInterpolator());
transAnim.setAnimationListener(new Animation.AnimationListener() {

@Override
public void onAnimationStart(Animation animation) {


}

@Override
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub

}

@Override
public void onAnimationEnd(Animation animation) {

final int left = image3.getLeft();
final int top = image3.getTop();
final int right = image3.getRight();
final int bottom = image3.getBottom();
image3.layout(left, top, right, bottom);

}
});
image3.startAnimation(transAnim);





private int getDisplayHeight() {
return this.getResources().getDisplayMetrics().heightPixels;
}

关于android - Ola 跳针动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47975887/

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