Friday, 6 February 2015

Android animation of image view moving and rotating



I'd like to make an animation that moves the image view from the beginning of the screen to the end, and each time randomizing the x position. How could I do that?



<set xmlns:android="http://ift.tt/nIICcg"
android:interpolator="@android:anim/linear_interpolator" >

<rotate
xmlns:android="http://ift.tt/nIICcg"
android:fromDegrees="0"
android:toDegrees="359"
android:pivotX="50%"
android:pivotY="50%"
android:duration="1000"
android:repeatCount="infinite"
/>
<translate
xmlns:android="http://ift.tt/nIICcg"
android:fromXDelta="0%"
android:fromYDelta="0%"
android:toYDelta="100%"
android:repeatCount="infinite"
android:duration="3000"
></translate>
</set>


I don't know how to randomize the X coordinate, and also why even though I used 0% and 100% it doesn't really start at the beginning of the screen and doesn't end at the end. Thanks for any help in advance!


No comments:

Post a Comment