[SOLVED] Combine Tweenzor with ofParameter in ofxGui

Hi !

I’m trying to connect an ofParamter (linked to an ofxGui) to a Tweenzor interpolation.
My idea is to have some ofxGui parameters controlled with a Tweenzor.


TweenParams params;
ofxPanel                 gui;
ofParameter<float>      _x1;
ofParameter<float>      _x2;


// GUI
gui.add(_x1.set( "x1", 0, 0, ofGetWidth() ));
gui.add(_x2.set( "x2", 0, 0, ofGetWidth() ));

_x1 = ofGetWidth()/2;
_x2 = ofGetWidth()/2;

// set a TweenParams from a ofParamter and add it to the Tweenzor
params.setup((float*)&_x1.get(), 0,ofGetWidth(),0,4,EASE_IN_OUT_EXPO);

// add a ofParamter into the Tweenzor
Tweenzor::add((float *)&_x2.get(), 0, ofGetWidth(), 0, 4,EASE_IN_OUT_EXPO);

The result is half satysfing … ;_(

In one hand, the Tween movement is done correctly by the boxes, when interpolation stops, i can move the value on the Gui slider and i see the boxes moving accordingly.

What i’m missing is that while the Tween is running, so being interpolated, the ofxGui slider doesn’t show the updated values …

Is my question understandable ?

I suspect that might be something wrong here ?

Tweenzor::add((float *)&_x2.get(), 0, ofGetWidth(), 0, 4,EASE_IN_OUT_EXPO);

Any idea how to make the Tweenzor’ed variable reflect it’s changes on a the Gui ?

Here the definitions in case some gets inspired …

void Tweenzor::add(float* a_property, float a_begin, float a_end, int a_delay, int a_duration, int a_easeType, float a_p, float a_a) 

const ParameterType & get() const;

I got it solved :wink: