0

I have a problem with moving animation. I want to create animation which start when I to a screen and she starts from touched place and go to end place like on this picture: enter image description here

The end place is constant. How Can I do this sinusoid movement?

edit1: I want to click and when i click, show image and he goes this way to end place. I don't click and drag this picture. This picture must shows and goes to this place without my help. Only what I do is touch the screen. How I can do that?I have a problem with moving animation. I want to create animation which start when I to a screen and she starts from touched place and go to end place like on this picture:

The end place is constant. How Can I do this sinusoid movement?

edit1: I want to click and when i click, show image and he goes this way to end place. I don't click and drag this picture. This picture must shows and goes to this place without my help. Only what I do is touch the screen. How I can do that?

edi233
  • 3,511
  • 13
  • 56
  • 97

2 Answers2

0

Check the sources of TranslationAnimation where the translation is done. Then build your function that maps the sinus function on the line from start to end. You could start with setting a horizontal line of with length dist(start,end) starting at (start), mapping sinus on it and then rotating it around your starting point.

Bondax
  • 3,143
  • 28
  • 35
0

I wrote something like this that allows curved animation, you can see the full answer (and working code) here: Problem to achieve curved animation

It shouldn't be too difficult to either chain a number of those together, or modify the algorithm to use a cubic (or higher) function to produce multiple curves.

Only caveat is that because of the bezier curve, there is no guarantee the path will actually travel through the middle point you give it. If this is a problem again you could easily replace the bezier algorithm I use in the above example with something more suitable for your needs.

Community
  • 1
  • 1
Sam Judd
  • 7,317
  • 1
  • 38
  • 38