mercredi 17 février 2016

How to rotate an image and it stop it randomly on multiple of 18 °

How to rotate an image and it stop it randomly on multiple of 18 °. I use these lines of code to make turn a spinning top and that works very well. I would want that it stops on multiple of 18 °, that I have to add? Thank you.

float deg = toupie1300.getRotation() + BASE_ROTATION_DEGREES + ((float) Math.random() * 360F); toupie1300.animate().rotation(deg).setDuration(DURATION) .setInterpolator(new AccelerateDecelerateInterpolator());




Aucun commentaire:

Enregistrer un commentaire