| 45 | } |
| 46 | |
| 47 | void LocationZoomer::Update() |
| 48 | { |
| 49 | if (mCurrentProgress < 1) |
| 50 | { |
| 51 | mCurrentProgress = ofClamp(mCurrentProgress + ofGetLastFrameTime() * mSpeed, 0, 1); |
| 52 | float ease; |
| 53 | if (mInVanityPanningMode) //ease in/out |
| 54 | ease = mCurrentProgress < 0.5 ? 2 * mCurrentProgress * mCurrentProgress : 1 - pow(-2 * mCurrentProgress + 2, 2) / 2; |
| 55 | else //ease out |
| 56 | ease = -1 * mCurrentProgress * (mCurrentProgress - 2); |
| 57 | gDrawScale = ofLerp(mStart.mZoomLevel, mDestination.mZoomLevel, ease); |
| 58 | ofVec2f offset; |
| 59 | offset.x = ofLerp(mStart.mOffset.x, mDestination.mOffset.x, ease); |
| 60 | offset.y = ofLerp(mStart.mOffset.y, mDestination.mOffset.y, ease); |
| 61 | TheSynth->SetDrawOffset(offset); |
| 62 | |
| 63 | if (mInVanityPanningMode && mCurrentProgress >= 1) |
| 64 | PickNewVanityPanningDestination(); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | void LocationZoomer::OnKeyPressed(char key) |
| 69 | { |
nothing calls this directly
no test coverage detected