Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to animate a transformation on sf::Sprite like setScale or setPosition?

ie: sprite.setScale(0.5f,0.5f);. I want the transition between normal and half scale be smooth.


share|improve this question
up vote 2 down vote accepted

Simply use interpolation between the two values.

A simple form:

Vector2 goalScale = new Vector2(1,1);
Vector2 resultScale = sprite.getScale();

resultScale+= (goalScale - resultScale)/2; // increase division for stronger easing


Alternatively use a C++ tweener library.

share|improve this answer
Thanks Sidar! It works, but i'll search for tweener library! – ApheX Jun 25 '13 at 9:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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