dayForNightSFPC icon indicating copy to clipboard operation
dayForNightSFPC copied to clipboard

smoothing should be every frame

Open ofZach opened this issue 8 years ago • 1 comments

smoothing should happen every every frame not on midi event -- (afaik I can see, smoothing is happening here....

https://github.com/ofZach/dayForNightSFPC/blob/master/addons/ofxParameterMidiSync/src/ofxParameterMidiInfo.cpp#L100-L107

I can't find an easy way to duplicate a parameterGroup (having a kind of shadow param group might be one way to do this, one gets update from midi, the other catches up to the unsmooth value)....

one simple solution (but requires editing projects) is to add variables that track, and add a function called smooth to baseScene, ie for yosukeJhonWhitneyMtrix:

// ofParameter param; ofParameter numOfGroup; ofParameter numOfBall; ofParameter radius; ofParameter speed; ofParameter ballRadius;

//----------------------------------------- if it can be smoothed, smooth it
ofParameter<float> radiusSmooth;
ofParameter<float> speedSmooth;
ofParameter<float> ballRadiusSmooth;

void smooth(){
    radiusSmooth = SMOOTH_AMOUNT * radiusSmooth + (1-SMOOTH_AMOUNT) * radius;
    speedSmooth = SMOOTH_AMOUNT * speedSmooth + (1-SMOOTH_AMOUNT) * radius;
    ballRadiusSmooth = SMOOTH_AMOUNT * ballRadiusSmooth + (1-SMOOTH_AMOUNT) * radius;
}
//-----------------------------------------

SMOOTH_AMOUNT can be defined in baseScene or appConstants (like 0.95, etc).

you will need to call smooth in scene manager before update....

can't seem to find a way to do this more automatically.... at least the params are pretty clear per project and it's just the floats to smooth. I hope this helps! zach

ofZach avatar Dec 19 '15 15:12 ofZach