1

I have an object that continuously follows the users touch coordinates. I would like to make it so the object has an easing effect.

by which i mean, the object has a start point and when the user touches the screen, said object would move to the users touch coordinates. which it already does but it jumps to the coordinates. i want a controlled transistion from point A to point B.

this easing or tween affect would need to happen on every frame if the user dragged or swipped their touch coordinates.

i have been reading about interpolation and animation affects for the android sdk but i dont really understand how to implement them on an object and not a view. or continuously as well.

any direction would be great. thank you!

joacampb
  • 177
  • 1
  • 18

1 Answers1

0

I built a complete tweening engine for Java. It doesn't allocate anything dynamically so it's totally safe for Android (I made it primarily to develop games on Android).

http://code.google.com/p/java-universal-tween-engine/

Your tween would look like:

Tween.to(yourObject, Type.POSITION, 1000)
     .target(touchX, touchY)
     .ease(Quad.OUT)
     .start(aManager);

I used a similar syntax as the TweenMax engine, so you shouldn't be lost too long :)

Aurelien Ribon
  • 7,548
  • 3
  • 43
  • 54
  • now that i remember i did read about this. i will try it out and post a progress report as soon as i can. thank you! – joacampb Feb 16 '12 at 19:24
  • i have everything set up but "Type.POSITION" continuously throws an error. Am i supposed to change that to something or import a specific resource? thanks! – joacampb Feb 16 '12 at 19:56
  • Type.POSITION was an example. If you follow the "Get Started" tutorial, you'll see that you need to implement your own types. Have a look at the "ParticleAccessor" class that is given in this page, it defines 3 static integers (POSITION_X, POSITION_Y and POSITION_XY): these are your custom types :) – Aurelien Ribon Feb 17 '12 at 08:37
  • unfortunately i could never get this this to work out. I switched to using the andEngine library which handles this natively. Thank you for your support – joacampb Feb 19 '12 at 03:46