Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. private void drawHourMinSec(Canvas canvas, double moment, boolean isHour, boolean isSecond) {
  2. double angle = Math.PI * moment / 30 - Math.PI / 2;
  3. int handRadius = isHour ? mRadius - mHandTruncation - mHourHandTruncation : mRadius - mHandTruncation;
  4. float pivotX = (float) (mWidth / 2 + Math.cos(angle) * handRadius);
  5. float pivotY = (float) (mHeight / 2 + Math.sin(angle) * handRadius);
  6. setPivotY(pivotY);
  7. setPivotX(pivotX);
  8. if (isSecond) mPaint.setColor(Color.RED);
  9.  
  10. canvas.drawLine(mWidth / 2, mHeight / 2, pivotX, pivotY, mPaint);
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement