ofxTween::map or general map question

Hi,

I know that below command line will do a nice job for remapping the value with val.

float amplitude = ofxTween::map( val , 0, max_val, 0, max_remap, clamp, easeQuad, easingType );

What if I want to remap it something like to be

What would be suggestions?

you have to combine two tweens. The first half would be, an easeOut, the next half would be an easeIn.

@Ahbee
but that would end up declaring two different variable, isn’t it?

I think I misunderstood your original question. I thought you were just trying to get a float variable to follow the bell curve path you posted. Can you give more context on your problem?

No I guess you are right, but how would I combine two ofxTween ?

float amplitude = ofxTween::map( val , 0, max_val/2, 0, max_remap, clamp, easeQuad, easingType );

float amplitude = ofxTween::map( val , max_val/2, max_val, 0, max_remap, clamp, easeQuad, easingType );

This would be the result? It would overwrite the variable, isn’t it?

that is not what map does. You want to use the easing function

ofxEasingExpo easing;
float amplitude;
if (time < duration/2.0) {
  amplitude = easing.easeOut(currentTime, 0, MaxAmp, duration/2.0);
}else{
  amplitude = easing.easeIn(currentTime, MaxAmp, 0, duration/2.0);
}

sorry it should be

ofxEasingExpo easing;
float amplitude;
if (time < duration/2.0) {
  amplitude = easing.easeOut(currentTime, 0, MaxAmp, duration/2.0);
}else{
  amplitude = easing.easeIn(currentTime-(duration/2.0), MaxAmp, 0, duration/2.0);
}