WolfSpyryt
Lurker
I have an Android Wear OS watch project. It has 3 watch hands(.png) and 3 watch hand shadows(.png) images.
It all works except I need to define an offset center point for the shadow images, and for that center point to be fixed.
I need each of the shadows to have a seperate center point.
When I try to move their center, the center point moves in orbit around mCenterX & mCenterY.
The mHoursPaint, mMinutesPaint and mSecondsPaint are the Hand shadow images.
The mHourPaint, nMinutePaint and mSecondPaint are main Hand images.
The mHourmPaint, mMinutemPaint and mSecondmPaint are for markers on hands.
Here is the code for the MyWatchFace.java:
..........................................................................................
.................................................................................
Thank you in advance for your help!
It all works except I need to define an offset center point for the shadow images, and for that center point to be fixed.
I need each of the shadows to have a seperate center point.
When I try to move their center, the center point moves in orbit around mCenterX & mCenterY.
The mHoursPaint, mMinutesPaint and mSecondsPaint are the Hand shadow images.
The mHourPaint, nMinutePaint and mSecondPaint are main Hand images.
The mHourmPaint, mMinutemPaint and mSecondmPaint are for markers on hands.
Here is the code for the MyWatchFace.java:
..........................................................................................
Java:
private void drawWatchFace(Canvas canvas) {
final float seconds =
(mCalendar.get(Calendar.SECOND) + mCalendar.get(Calendar.MILLISECOND) / 1000f);
final float secondsRotation = seconds * 6f;
final float minutesRotation = mCalendar.get(Calendar.MINUTE) * 6f;
final float hourHandOffset = mCalendar.get(Calendar.MINUTE) / 2f;
final float hoursRotation = (mCalendar.get(Calendar.HOUR) * 30) + hourHandOffset;
canvas.save();
canvas.rotate(hoursRotation, mCenterX, mCenterY);
canvas.drawBitmap(mHoursPaint, 4,4, paint);
canvas.drawBitmap(mHourPaint, 0,0, paint);
canvas.drawBitmap(mHourmPaint, 0,0, paint);
canvas.rotate(minutesRotation-hoursRotation,mCenterX, mCenterY);
canvas.drawBitmap(mMinutesPaint, 6,6, paint);
canvas.drawBitmap(mMinutePaint, 0,0 , paint);
canvas.drawBitmap(mMinutemPaint, 0,0 , paint);
canvas.rotate(secondsRotation-minutesRotation, mCenterX, mCenterY);
canvas.drawBitmap(mSecondsPaint, 8, 8, paint);
canvas.drawBitmap(mSecondPaint, 0, 0 , paint);
canvas.drawBitmap(mSecondmPaint, 0, 0 , paint);
canvas.restore();
.................................................................................
Thank you in advance for your help!
Last edited: