MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / Update

Method Update

Source/LocationZoomer.cpp:47–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47void 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
68void LocationZoomer::OnKeyPressed(char key)
69{

Callers

nothing calls this directly

Calls 4

ofClampFunction · 0.85
ofGetLastFrameTimeFunction · 0.85
ofLerpFunction · 0.85
SetDrawOffsetMethod · 0.45

Tested by

no test coverage detected