I have an image, which I have already clipped in circle. I want this image to animate over an oval path within angle 20 to 135.
I have searched a lott but i dint get exact answer.
Any help will be greatly appreciated?
I have an image, which I have already clipped in circle. I want this image to animate over an oval path within angle 20 to 135.
I have searched a lott but i dint get exact answer.
Any help will be greatly appreciated?
This animation can be achieved using the Android Accelerometer and the Sensor Manager class.
Refer to this link. It has 3 different detailed sample codes.
Moving an image using Accelerometer of android
Hope it helps.
Check this out, I was able to move an image on a path. You can simply define path
AnimatorPath path = new AnimatorPath();
path.moveTo(0, 0);
path.lineTo(0, 300);
path.curveTo(100, 0, 300, 900, 400, 500);
public static ObjectAnimator ofObject (Object target, String propertyName, TypeEvaluator evaluator, Object... values)
Constructs and returns an ObjectAnimator that animates between Object values. A single value implies that that value is the one being animated to. Two values imply a starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).
Parameters
target: The object whose property is to be animated. This object should have a public method on it called setName(), where name is the value of the propertyName parameter.
propertyName: The name of the property being animated.
evaluator: A TypeEvaluator that will be called on each animation frame to provide the necessary interpolation between the Object values to derive the animated value.
values: A set of values that the animation will animate between over time.
Returns
An ObjectAnimator object that is set up to animate between the given values.
For more reference you may check here.