general/clocks/src/clock.js
/**
     * Paints the analog second hand on the clock.
     * Required by the drawClock function.
     * Scaled to a 200px diameter clock rotated to origin of 12o'clock.
     * @private
     */
Paints the analog second hand on the clock.
Required by the drawClock function.
Scaled to a 200px diameter clock rotated to origin of 12o'clock.
@private
Paints the analog second hand on the clock . Required by the drawClock function . Scaled to a 200px diameter clock rotated to origin of 12o ' clock . @private
function drawSecondHand() {
        var begin = -28,
            end = 63,
            wheelRadius = 10,
            sec = now.seconds();
        ctx.save();
        ctx.lineWidth = 2;
        ctx.strokeStyle = "#D40000";
        ctx.fillStyle = "#D40000";
        ctx.lineCap = "round";
        ctx.rotate(sec * Math.PI/30);
        ctx.beginPath();
        ctx.moveTo(begin, 0);
        ctx.lineTo(end, 0);
        ctx.stroke();
        ctx.beginPath();
        ctx.arc(0, 0, wheelRadius, 0, Math.PI*2, true);
        ctx.closePath();
        ctx.fill();
        ctx.beginPath();
        ctx.arc(end, 0, wheelRadius, 0 , Math.PI*2, true);
        ctx.closePath();
        ctx.stroke();
        ctx.beginPath();
        ctx.fillStyle = "#000"
        ctx.arc(0, 0, wheelRadius/2, 0, Math.PI*2, true);
        ctx.closePath();
        ctx.fill();
        ctx.restore();
    }
function drawSecondHand ( ) { var begin = - 28 , end = 63 , wheelRadius = 10 , sec = now . seconds ( ) ; ctx . save ( ) ; ctx . lineWidth = 2 ; ctx . strokeStyle = "#D40000" ; ctx . fillStyle = "#D40000" ; ctx . lineCap = "round" ; ctx . rotate ( sec * Math . PI / 30 ) ; ctx . beginPath ( ) ; ctx . moveTo ( begin , 0 ) ; ctx . lineTo ( end , 0 ) ; ctx . stroke ( ) ; ctx . beginPath ( ) ; ctx . arc ( 0 , 0 , wheelRadius , 0 , Math . PI * 2 , true ) ; ctx . closePath ( ) ; ctx . fill ( ) ; ctx . beginPath ( ) ; ctx . arc ( end , 0 , wheelRadius , 0 , Math . PI * 2 , true ) ; ctx . closePath ( ) ; ctx . stroke ( ) ; ctx . beginPath ( ) ; ctx . fillStyle = "#000" ctx . arc ( 0 , 0 , wheelRadius / 2 , 0 , Math . PI * 2 , true ) ; ctx . closePath ( ) ; ctx . fill ( ) ; ctx . restore ( ) ; }
Paints the analog second hand on the clock.
Paints the analog second hand on the clock .
// Drawing constraints for the second hand
 // Extend the second hand beyond the center
 // Don't touch any previous settings on the stack
 // Styling for most of the parts of the second hand
 // Every sixty seconds is one revolution
 // Stem of the second hand
 // Central "wheel" of the second hand
 // Bulb of the second hand
 // Hole in the central "wheel" of the second hand
 // Requires a style change so do this last
 // Restore previous settings on the canvas stack
