Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding ability to give decoration to hour and minute hands.

  • Loading branch information...
commit fb53847ffa5b2d24267e58fe1541fa88d458fc9e 1 parent a656938
Evgheny authored
Showing with 19 additions and 7 deletions.
  1. +19 −7 coolclock.js
View
26 coolclock.js
@@ -241,20 +241,32 @@ CoolClock.prototype = {
this.renderRadius+this.renderRadius/2
);
}
+
+ var hourA = (hour%12)*5 + min/12.0,
+ minA = min + sec/60.0,
+ secA = sec;
// Draw the hands
if (skin.hourHand)
- this.radialLineAtAngle(this.tickAngle(((hour%12)*5 + min/12.0)),skin.hourHand);
+ this.radialLineAtAngle(this.tickAngle(hourA),skin.hourHand);
if (skin.minuteHand)
- this.radialLineAtAngle(this.tickAngle((min + sec/60.0)),skin.minuteHand);
+ this.radialLineAtAngle(this.tickAngle(minA),skin.minuteHand);
if (this.showSecondHand && skin.secondHand)
- this.radialLineAtAngle(this.tickAngle(sec),skin.secondHand);
-
- // Second hand decoration doesn't render right in IE so lets turn it off
- if (!CoolClock.config.isIE && this.showSecondHand && skin.secondDecoration)
- this.radialLineAtAngle(this.tickAngle(sec),skin.secondDecoration);
+ this.radialLineAtAngle(this.tickAngle(secA),skin.secondHand);
+
+ // Hands decoration - not in IE
+ if (!CoolClock.config.isIE) {
+ if (skin.hourDecoration)
+ this.radialLineAtAngle(this.tickAngle(hourA), skin.hourDecoration);
+
+ if (skin.minDecoration)
+ this.radialLineAtAngle(this.tickAngle(minA), skin.minDecoration);
+
+ if (this.showSecondHand && skin.secondDecoration)
+ this.radialLineAtAngle(this.tickAngle(secA),skin.secondDecoration);
+ }
},
// Check the time and display the clock
Please sign in to comment.
Something went wrong with that request. Please try again.