In libGDX there is a simple fade Interpolation that speeds up towards the end of the action animation. But what I am looking for is the reversed of it, it needs to start fast and slow down near the end. Is there a Interpolation function for that or how can I create this effect myself?

Currently i'm directly just initiating the action from the actor.

actor.addAction(Actions.moveTo(currentTouch.x - actor.getWidth() / 2,
 currentTouch.y - actor.getHeight() / 2,

I use Interpolation.bounceIn.apply(current_position, target_position, smoothness) to achieve this effect. Take a look at this.

Edit I found the answer on their site

MoveToAction action = Actions.action(MoveToAction.class);
action.setPosition(x, y);

(I haven't tested it !!)

Take a look at the full tutorial here

  • \$\begingroup\$ Thanks, could you demonstrate here how I would use that within the addAction method for a complete answer? actor.addAction(Actions.moveTo(currentTouch.x - actor.getWidth() / 2, currentTouch.y - actor.getHeight() / 2, .2f, Interpolation.bounceIn.apply(2,2,2))); does not even compile. Still have to watch the vid but a complete answer here would benefit. \$\endgroup\$ – Madmenyo Jan 8 '15 at 21:22
  • \$\begingroup\$ I've edited the answer. Check it out. \$\endgroup\$ – Ion Farima Jan 8 '15 at 21:49
  • \$\begingroup\$ bounceOut does not do what I want. It bounces, I need a powerfull start that fades out smoothly. It looks somewhat like pow2Out in the video but still not exactly what i want. Likewise i cannot seem to combine Interpolation.bounciIn.apply(float,float,float) with setInterpolation. \$\endgroup\$ – Madmenyo Jan 8 '15 at 21:59
  • \$\begingroup\$ Interpolation.bounceIn.apply(current_position, target_position, smoothness) is out of scene2d, try this format action.setInterpolation(Interpolation.TYPE); \$\endgroup\$ – Ion Farima Jan 8 '15 at 22:02
  • \$\begingroup\$ You could use Interpolation.fade or Interpolation.pow4out or ` Interpolation.pow5out, it depends of what do you need \$\endgroup\$ – Ion Farima Jan 8 '15 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.