I've been using an Animation class for my project that features dynamic movement with different types of easing. It's based on Robert Penner's easing equations [
http://www.robertpenner.com/easing/], which have been broadly used for Flash development, and I think they work really well for games.
The way it works is very simple. You create an animation object, choosing the initial and final values, duration, type and initial delay of the animation. Then, in every iteration you call the update() method to update the position of the animation one frame at a time. You can retrieve the current position using getX and getY methods.
There are 8 types of animation so far:
enum tipoAnim {tEaseInQuad, tEaseOutQuad, tEaseInOutQuad,
tEaseInCubic, tEaseOutCubic, tEaseInOutCubic,
tEaseInQuart, tEaseOutQuart, tEaseInOutQuart,
tEaseOutBack, tLinear};
Example:
boost::scoped_ptr<Animacion> myAnim (new Animacion(initialX, initialY, finalX, finalY, duration, Animation::tipoAnim, delay));
myAnim -> update();
myImage -> draw(myAnim -> getX(), myAnim -> getY(), 1);
Source file:
https://forja.rediris.es/plugins/scmsvn/viewcvs.php/trunk/animacion.cpp?root=cusl4-oflute&view=logHeader file:
https://forja.rediris.es/plugins/scmsvn/viewcvs.php/trunk/animacion.h?root=cusl4-oflute&view=logHope you find it useful!