@Override public void onAnimationUpdate(final ValueAnimator animation) { float value = (Float) animation.getAnimatedValue(); zoomTo(value, destX, destY); postInvalidateOnAnimation(); } }
/** * Scale to the target scale * * @param scale the target zoom * @param durationMs the animation duration */ public void zoomTo(float scale, long durationMs) { PointF center = getCenter(); zoomTo(scale, center.x, center.y, durationMs); }
protected void zoomTo(float scale) { if (DEBUG) { Log.i(TAG, "zoomTo: " + scale); } if (scale > getMaxScale()) { scale = getMaxScale(); } if (scale < getMinScale()) { scale = getMinScale(); } if (DEBUG) { Log.d(TAG, "sanitized scale: " + scale); } PointF center = getCenter(); zoomTo(scale, center.x, center.y); }
public void resetMatrix() { if (DEBUG) { Log.i(TAG, "resetMatrix"); } mSuppMatrix = new Matrix(); float scale = getDefaultScale(getDisplayType()); setImageMatrix(getImageViewMatrix()); if (DEBUG) { Log.d(TAG, "default scale: " + scale + ", scale: " + getScale()); } if (scale != getScale()) { zoomTo(scale); } postInvalidate(); }
/** * Scale to the target scale * * @param scale the target zoom * @param durationMs the animation duration */ protected void zoomTo(float scale, float durationMs) { PointF center = getCenter(); zoomTo(scale, center.x, center.y, durationMs); }
@Override public void run() { long now = System.currentTimeMillis(); float currentMs = Math.min(durationMs, now - startTime); float newScale = (float) mEasing.easeInOut(currentMs, 0, deltaScale, durationMs); zoomTo(oldScale + newScale, destX, destY); if (currentMs < durationMs) { mHandler.post(this); } else { onZoomAnimationCompleted(getScale()); center(true, true); } } });
public void resetMatrix() { if (LOG_ENABLED) { Log.i(LOG_TAG, "resetMatrix"); } mSuppMatrix = new Matrix(); float scale = getDefaultScale(mScaleType); setImageMatrix(getImageViewMatrix()); if (LOG_ENABLED) { Log.d(LOG_TAG, "default scale: " + scale + ", scale: " + getScale()); } if (scale != getScale()) { zoomTo(scale); } postInvalidate(); }
protected void zoomTo(float scale) { if (LOG_ENABLED) { Log.i(LOG_TAG, "zoomTo: " + scale); } if (scale > getMaxScale()) scale = getMaxScale(); if (scale < getMinScale()) scale = getMinScale(); if (LOG_ENABLED) { Log.d(LOG_TAG, "sanitized scale: " + scale); } PointF center = getCenter(); zoomTo(scale, center.x, center.y); }