//---------------------------------------------------------- void ofRectangle::scaleTo(const ofRectangle& targetRect, ofScaleMode scaleMode) { if(scaleMode == OF_SCALEMODE_FIT) { scaleTo(targetRect, OF_ASPECT_RATIO_KEEP, OF_ALIGN_HORZ_CENTER, OF_ALIGN_VERT_CENTER); } else if(scaleMode == OF_SCALEMODE_FILL) { scaleTo(targetRect, OF_ASPECT_RATIO_KEEP_BY_EXPANDING, OF_ALIGN_HORZ_CENTER, OF_ALIGN_VERT_CENTER); } else if(scaleMode == OF_SCALEMODE_CENTER) { alignTo(targetRect, OF_ALIGN_HORZ_CENTER, OF_ALIGN_VERT_CENTER); } else if(scaleMode == OF_SCALEMODE_STRETCH_TO_FILL) { scaleTo(targetRect, OF_ASPECT_RATIO_IGNORE, OF_ALIGN_HORZ_CENTER, OF_ALIGN_VERT_CENTER); } else { scaleTo(targetRect, OF_ASPECT_RATIO_KEEP); } }
/** * Get the point right between two other points (in spherical sense, so the result has the middle abs of gps1 and gps2) */ template<typename T> Spherical<T> calculateCenter(const Spherical<T>& gps1, const Spherical<T>& gps2) { Cartesian<T> cartesian1 = sphericalToCartesian(gps1) / 2; Cartesian<T> cartesian2 = sphericalToCartesian(gps2) / 2; Spherical<T> newPoint = cartesianToSpherical(cartesian1 + cartesian2); return scaleTo(newPoint, (gps1.z + gps2.z) / 2); }
//---------------------------------------------------------- void ofRectangle::scaleTo(const ofRectangle& targetRect, ofAspectRatioMode subjectAspectRatioMode, ofAlignHorz sharedHorzAnchor, ofAlignVert sharedVertAnchor) { scaleTo(targetRect, subjectAspectRatioMode, sharedHorzAnchor, sharedVertAnchor, sharedHorzAnchor, sharedVertAnchor); }
void BasicScreenObject::scaleTo(float _endscale, float _scaletime, float (ofxTransitions::*ease) (float,float,float,float)) { scaleTo(_endscale, _endscale, _endscale, _scaletime, ease, 0); }
void BasicScreenObject::scaleTo(float _endscale, float _scaletime) { scaleTo(_endscale, _endscale, _endscale, _scaletime, &ofxTransitions::easeInOutCubic, 0); }