bin_ja
bin_ja

Reputation: 21

Issue in Animating a View from one position to another position

Issue in animating a View from one position to another another. View is going to the given position but it's really fast even i added 5 sec delay also

 Path path = new Path();
 path.moveTo(625, 300);
 ObjectAnimator animator = ObjectAnimator.ofFloat(device, View.X, View.Y, path);
animator.setDuration(5000);
animator.start();

Upvotes: 1

Views: 43

Answers (1)

MDikkii
MDikkii

Reputation: 283

This line is a problem in your code:

path.moveTo(625, 300);

Path.moveTo() makes something like move pencil to 625, 300. And nothing more. You didn't tell to draw a path anywhere.

Changing moveTo to path.lineTo(625,300) should work for you.

You can see more examples of animation on Android Dev https://developer.android.com/training/animation/reposition-view

Upvotes: 1

Related Questions