Code example for PointF

Methods: length

0
	} 
 
	public void nudge(float vx, float vy) {
		stop(); 
		motionEndTime = motionStartTime + 10000;
		transInc = new PointF(vx/1000/startScale, vy/1000/startScale);
		targetScale = startScale;
		friction = 0.0005f;
		mWideningAmplitude = 0.1;
		move(); 
	} 
 
	public void showRect(Rect r) {
		stop(); 
		RectF target = new RectF(r);
		mBaseMatrix.mapRect(target);
 
		targetScale = Math.min(
			(float)mThisWidth / (target.right - target.left),
			(float)mThisHeight / (target.bottom - target.top));
 
		PointF targetTrans = new PointF(
			(mThisWidth - target.right - target.left)/2,
			(mThisHeight - target.top - target.bottom)/2);
		transInc = new PointF(
			(targetTrans.x - startTrans.x) / duration,
			(targetTrans.y - startTrans.y) / duration);
 
		motionEndTime = motionStartTime + duration;
		friction = 0;
		mWideningAmplitude = Math.max(Math.abs(targetScale - startScale)/4, 0.5f);
		move(); 
	} 
 
 
	private void move() { 
		scaleInc = (targetScale - startScale) / duration;
		final PointF frictionAcc = new PointF(transInc.x, transInc.y);
		frictionAcc.x *= -friction/transInc.length()/2;
		frictionAcc.y *= -friction/transInc.length()/2;
		if(friction != 0) {
			motionEndTime = motionStartTime + (long)(transInc.length() / friction);
		} 
 
		mHandler.post(new Runnable() { 
				public void run() { 
					long t = System.currentTimeMillis();
Stop searching for code, let great code find you!  Add Codota to your java IDE