float ofxTween::map(float value, float inputMin, float inputMax, float outputMin, float outputMax, bool clamp, ofxEasing & easing, ofxEasingType type) { ofxEasingArgs args; if(clamp){ value = ofClamp(value, inputMin, inputMax); } args.t = value - inputMin; args.c = outputMax - outputMin; args.d = inputMax - inputMin; args.b = outputMin; switch (type) { case ofxTween::easeIn: { easing.easeIn(args); break; } case ofxTween::easeOut: { easing.easeOut(args); break; } default: easing.easeInOut(args); } return args.res; }
float ofxTween::map(float value, float inputMin, float inputMax, float outputMin, float outputMax, bool clamp, const ofxEasing & easing, ofxEasingType type) { if(clamp){ value = ofClamp(value, inputMin, inputMax); } float t = value - inputMin; float c = outputMax - outputMin; float d = inputMax - inputMin; float b = outputMin; float res; switch (type) { case ofxTween::easeIn: { res = easing.easeIn(t,b,c,d); break; } case ofxTween::easeOut: { res = easing.easeOut(t,b,c,d); break; } default: res = easing.easeInOut(t,b,c,d); } return res; }