SFML community forums

Help => Window => Topic started by: AdventWolf on September 08, 2010, 05:16:14 am

Title: Possibility of displaying Zoom/Rotate in increments
Post by: AdventWolf on September 08, 2010, 05:16:14 am
I want to implement a function that gradually performs some functions and displays it in increments, instead of when I choose to zoom in, it instantaneously zooms to that setting.

I have tried using a for loop, that zooms and rotates on a certain degree each turn, but it is still instantaneous, and doesn't display in increments.

Is there a way I can implement this? To delay the loop each turn?

Thanks.
Title: Possibility of displaying Zoom/Rotate in increments
Post by: panithadrum on September 08, 2010, 08:55:19 am
That's because the for loop begins and ends in the same time step. You must do it so you do a step each frame.

I would do a class called Transition or something, like this.
Code: [Select]
class Transition
{
public:
    float Origin, Destination, Velocity;

    Transition(float origin, float destination, float velocity);
    void Update(float time);
};


Be original, you can do some different transitions!
Title: Possibility of displaying Zoom/Rotate in increments
Post by: WitchD0ctor on September 22, 2010, 08:16:57 am
sounds like you can use some good ol' LERP! (http://en.wikipedia.org/wiki/Linear_interpolation)
Title: Possibility of displaying Zoom/Rotate in increments
Post by: AdventWolf on September 24, 2010, 05:40:05 am
Thanks guys, I've kind of backed away from sfml for a bit to head back to the books to better understand the basics. I'll be sure to look into this.