我想從我的屏幕中心到我的屏幕左上角翻譯一個對象。翻譯動畫座標發佈多個設備
我希望翻譯動畫在所有設備上都是相同的 目前我給出的翻譯值在不同的設備上[對象的動畫位置不同]之後是不同的。
有沒有辦法來翻譯和傳遞值,這將導致動畫跨設備相同?
我的代碼
ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(progressWidget, "scaleX", 0.355f);
ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(progressWidget, "scaleY", 0.355f);
scaleDownX.setDuration(3000);
scaleDownY.setDuration(3000);
ObjectAnimator translateX = ObjectAnimator.ofFloat(progressWidget, "translationX", -435f);
translateX.setRepeatCount(0);
translateX.setDuration(3000);
ObjectAnimator translateY = ObjectAnimator.ofFloat(progressWidget, "translationY", -295f);
translateY.setRepeatCount(0);
translateY.setDuration(3000);
//sequential animation
AnimatorSet set = new AnimatorSet();
set.play(scaleDownX).with(scaleDownY).with(translateX).with(translateY);
//set.start();
嘿感謝,如果沒有太多的麻煩,你能解釋一下你的代碼段是幹什麼的? – ViVekH
添加一些解釋 –
不工作,doesnt去頂邊(0,0),爲什麼-location [0]? – ViVekH