general/clocks/src/clock.js
/**
     * Draws the clock at the current time.
     * Mainly called by the draw function.
     */
Draws the clock at the current time.
Mainly called by the draw function.
Draws the clock at the current time . Mainly called by the draw function .
function drawClock() {
        var scaleFactor = diameter/defaultDiameter;
        ctx.save();
        ctx.clearRect(0, 0, diameter , diameter);
        ctx.translate(radius, radius);
        ctx.scale(scaleFactor, scaleFactor);
        ctx.rotate(-Math.PI/2);
        if (alarm) {
            drawAlarmHourHand();
            drawAlarmMinuteHand();
            drawAlarmSecondHand();
        }
        drawHourMarks();
        drawMinuteMarks();
        drawHourHand();
        drawMinuteHand();
        drawSecondHand();
        drawClockFace();
        ctx.restore();
    }
function drawClock ( ) { var scaleFactor = diameter / defaultDiameter ; ctx . save ( ) ; ctx . clearRect ( 0 , 0 , diameter , diameter ) ; ctx . translate ( radius , radius ) ; ctx . scale ( scaleFactor , scaleFactor ) ; ctx . rotate ( - Math . PI / 2 ) ; if ( alarm ) { drawAlarmHourHand ( ) ; drawAlarmMinuteHand ( ) ; drawAlarmSecondHand ( ) ; } drawHourMarks ( ) ; drawMinuteMarks ( ) ; drawHourHand ( ) ; drawMinuteHand ( ) ; drawSecondHand ( ) ; drawClockFace ( ) ; ctx . restore ( ) ; }
Draws the clock at the current time.
Draws the clock at the current time .
// Scale the clock according to the ratio of our default diameter.
 // We want to end up at the same state as we began, a courtesy
 // Clean off the old clock
 // Setup our central drawing point from the center of the clock's canvas
 // Due to how canvas handles angular rotation around the origin
 // this initial rotation transforms horizontal lines to vertical
 // 12 o'clock lines. This makes the following time calculations
 // easier and relative from the "straight up" position.
 // Draw the phantom alarm hands if the alarm is set, draw it first
 // Draw out the clock
 // Restore the transformation stack to where it was before we started
