I’m currently starting my first project with OF. I’ve been working with actionscript a lot and miss a convenient tweening tool in OF. I’ve seen there has been an attempt to create a tweener, but I think one could do better. I was thinking of looking at some of the ideas that the Tweenlite library for AS3 offers. A call to the tweener could look something like this:
ofxTweener::to ( [tms time in ms], [ptw pointer to tweening function], [pf pointer to float], [f float] );
This call would tween the float which the pointer pf is pointing to to the new value the float f defines in tms milliseconds using the ptw tweening function. I guess one would have to call an update function in the ofxTweener class from the main update routine so that the tweener could work this way.
I’ve been reading about an event system to be integrated into of sometime soon, I think that would probably work really well together with my proposed ofxTweener.
My actual question is, would anybody apreciate me putting work into the ofxTweener class, and does my proposed functionality make sense to everyone?
I second this… it would be really nice to have a simple tweening library similar to how AS3 has Tweener or Tweenlite. However to work similar to Flash using the poco events in 0.0.6 would be best to target the specific object, Also ofxInteractiveObject might be a good library to look at.
Some functions Tweenlite has build in would be really useful such as function proxies and delayed function calls etc.
sorry arturo for bothering again, but I would love to use the tweener addon for a multitouch project for university right now and it’s pretty urgant in terms of time so I was wondering if you are done with it or could upload the unpolished version
[quote author=“arturo”]oh sorry! totally forgot… going to pack it and upload.
EDIT: there it is :)[/quote]
Hey Arturo
I’m trying to build in codeblocks windows and i get the following build errors:
C:\openframeworks\v0.06\addons\ofxTween\src\ofxTween.h|59|error: uint' does not name a type| C:\openframeworks\v0.06\addons\ofxTween\src\ofxTween.h|60|error:uint’ has not been declared|
C:\openframeworks\v0.06\addons\ofxTween\src\ofxTween.h|60|error: ISO C++ forbids declaration of duration' with no type| C:\openframeworks\v0.06\addons\ofxTween\src\ofxTween.cpp|87|error: variable or fieldsetDuration’ declared void|
C:\openframeworks\v0.06\addons\ofxTween\src\ofxTween.cpp|87|error: int ofxTween::setDuration' is not a static member ofclass ofxTween’|
C:\openframeworks\v0.06\addons\ofxTween\src\ofxTween.cpp|87|error: uint' was not declared in this scope| C:\openframeworks\v0.06\addons\ofxTween\src\ofxTween.cpp|87|error: expected,’ or ;' before '{' token| C:\openframeworks\v0.06\addons\ofxTween\src\ofxTween.cpp|91|error:uint’ does not name a type|
yes uint is a typedef or something like that, that doesn’t exist in windows. just substitute all of them with unsigned. will change it and re-upload as soon as i have time.
i made a install.xml file for this as I was having a few small problems that the install.xml fixed. Ive moved the src up a level so that it sits in ofxTween/src instead of ofxTween/ofxTween/src
I’m raising this post from the dead to mention that i’ve extended ofxTween so that you can use it like ofMap, but have tweened values.
I’ve added a static map() function to the existing ofxTween that acts just like ofMap (give it an input min/max, get an output min/max) but also lets you supply an easing equation and type.
included there is an xcode project with an example showing how to use the new mapping function.
This is useful when animating values with things other than time (for example the mouse position, or any other value) where you’d want something more elegant than linear mapping with ofMap. it also doesn’t require creating tween objects at all, which can be more convenient some times.