In case you use Thor, you could also take a look at the
Animation module.
You can use it as follows (see
here for a more complex example):
// Create animation, where each frame has specified duration and texture rect
thor::FrameAnimation animation;
animation.addFrame(sf::seconds(0.2f), sf::IntRect(...));
animation.addFrame(sf::seconds(0.1f), sf::IntRect(...));
// Create object that stores multiple animations and accesses them by string
thor::Animator<sf::Sprite, std::string> animator;
animator.addAnimation("anim", animation, sf::seconds(1.f));
animator.playAnimation("anim");
// Game loop: Update animator according to passed time, animate sprite
sf::Time frameTime = ...;
animator.update(frameTime);
animator.animate(sprite);
The animations are not limited to texture rects, also colorizing and fading animations are provided. And you can define your own animations easily.