2014-03-05 28 views
2

我要開發像下面的圖像的應用如何用隨機方向動畫android Imageview?

enter image description here

我想2,3,4,5,6動畫imageviews到ImageView的1反之亦然

請任何一個幫助我如何做到這一點

+0

要動畫的所有圖像點擊中心的圖像查看? – Piyush

+0

@PiyushGupta我想動畫所有的圖像,當活動開始時沒有點擊居中imageview – Krishna

+0

看看這個鏈接https://github.com/siyamed/android-satellite-menu –

回答

2
int distance = 100; //the distance to move in pixels 
int duration = 500; //the duration of the animation in ms 

double direction = Math.random() * 2 * Math.PI; 

int translationX = Math.cos(direction) * distance; 
int translationY = Math.sin(direction) * distance; 

yourImageView.animate().translationX(translationX).translationY(translationY).setDuration(duration).start(); 
+0

這個答案幫助我達到了完成我的要求的想法。謝謝馬克 – Krishna

+0

適合我..適合多個隨機動畫 –