How to rotate object in a circle in android -
i have circle object , inside of there more small objects supposed turn around circle. circle spinning can not rotate objects large circle.
i happy if help
thank you
rotate of circle
<?xml version="1.0" encoding="utf-8"?> <set android:interpolator="@android:anim/linear_interpolator" xmlns:android="http://schemas.android.com/apk/res/android"> <rotate android:todegrees="360" android:startoffset="0" android:repeatmode="restart" android:repeatcount="800" android:pivoty="50%" android:pivotx="50%" android:fromdegrees="0" android:duration="3500"/> </set>
rotate of object inside circle
<?xml version="1.0" encoding="utf-8"?> <set android:interpolator="@android:anim/linear_interpolator" xmlns:android="http://schemas.android.com/apk/res/android"> <rotate android:todegrees="360" android:startoffset="0" android:repeatmode="restart" android:repeatcount="800" android:pivoty="50%" android:pivotx="50%" android:fromdegrees="0" android:duration="3500" /> </set>
and in code :
animation animrotate = animationutils.loadanimation(this, r.anim.rotate); imageview mimage =(imageview)this.findviewbyid(r.id.image); animrotate= animationutils.loadanimation(this, r.anim.rotateobject); mimage.startanimation(animrotate);
replace
android:pivoty="0%" android:pivotx="100%"
by
android:pivoty="50%p" android:pivotx="50%p"
in children animation. set pivot relative view's parent.
Comments
Post a Comment