Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Framerate independent #9

Open
RogerGMartins opened this issue Jan 31, 2014 · 2 comments
Open

Framerate independent #9

RogerGMartins opened this issue Jan 31, 2014 · 2 comments

Comments

@RogerGMartins
Copy link

Hello, how would one turn the tweens framerate independent?

@arturoc
Copy link
Owner

arturoc commented Jan 31, 2014

use time instead of frames to do the calculations, with the map functions:

ofxTween::map(ofGetElapsedTimef(),initTme,endTime,initValue,endValue,clamp,ofxTweenEaseLinear());

where initTime, endTime are the times at which your animation started and should end and initValue, endValue the values you'll use for animation, so for example if you want to do an animation of something moving from the left to right in the screen that takes 1 second:

endTime = initTime + 1;
initValue = 0;
endValue = ofGetWidth()
ofxTween::map(ofGetElapsedTimef()-initTime,initTme,endTime,initValue,endValue,clamp,ofxTweenEaseLinear());

where you fix initTime at some point to the current ofGetElapsedTimef()

@RogerGMartins
Copy link
Author

very cool, thanks alot mate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants