SHARE
TWEET

Untitled

a guest Jan 12th, 2017 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Override protected void onDraw(Canvas canvas) {
  2.     super.onDraw(canvas);
  3.     canvas.rotate(2.5f, halfWidth, getHeight());
  4.     for (int i=0; i<BLOCKS; i++) {
  5.       canvas.drawRect(getWidth() / 2 - outerRadius, getHeight() - blockWidth,
  6.           getWidth() / 2 - innerRadius, getHeight(),
  7.           i > activeBlocks ? blockPaint : activeBlockPaint);
  8.       canvas.rotate(ROTATE_ANGLE, halfWidth, getHeight());
  9.     }
  10.   }
  11.  
  12.   public void setAngle(float angle) {
  13.     int oldActiveBlocks = activeBlocks;
  14.     activeBlocks = (int) (angle / ROTATE_ANGLE);
  15.     currentAngle = angle;
  16.     if (oldActiveBlocks != activeBlocks) postInvalidate();
  17.   }
RAW Paste Data
Want to get better at Java?
Learn to code Java in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top