moveTo(angle){
        // first test to see of the angle called is beyond the tolerance
        // for a redraw
        if(Math.abs(angle - this.angle) > this.tolerance ||
            // and then call the predicate to see if a redraw is needed
            this.draw_test(this.angle,this.last_draw_time) ){
            // rub out the old hand line
            var background = this.color_bg_supplier();
            g.setColor(background[0],background[1],background[2]);
            g.drawLine(this.centerX, this.centerY, this.last_x, this.last_y);
            // Now draw the new hand line
            var hand_color = this.color_fg_supplier();
            g.setColor(hand_color[0],hand_color[1],hand_color[2]);
            var x2 = this.centerX + this.length*Math.sin(angle);
            var y2 = this.centerY - this.length*Math.cos(angle);
            g.drawLine(this.centerX, this.centerY, x2, y2);
            // and store the last draw details for the next call
            this.last_x = x2;
            this.last_y = y2;
            this.angle = angle;
            this.last_draw_time = new Date();
            this.active = true;
            return true;
        } else {
            this.active = false;
            return false;
        }
    }
// method to move the hand to a new angle
method to move the hand to a new angle
method to move the hand to a new angle
moveTo(angle){
        if(Math.abs(angle - this.angle) > this.tolerance ||
            this.draw_test(this.angle,this.last_draw_time) ){
            var background = this.color_bg_supplier();
            g.setColor(background[0],background[1],background[2]);
            g.drawLine(this.centerX, this.centerY, this.last_x, this.last_y);
            var hand_color = this.color_fg_supplier();
            g.setColor(hand_color[0],hand_color[1],hand_color[2]);
            var x2 = this.centerX + this.length*Math.sin(angle);
            var y2 = this.centerY - this.length*Math.cos(angle);
            g.drawLine(this.centerX, this.centerY, x2, y2);
            this.last_x = x2;
            this.last_y = y2;
            this.angle = angle;
            this.last_draw_time = new Date();
            this.active = true;
            return true;
        } else {
            this.active = false;
            return false;
        }
    }
moveTo ( angle ) { if ( Math . abs ( angle - this . angle ) > this . tolerance || this . draw_test ( this . angle , this . last_draw_time ) ) { var background = this . color_bg_supplier ( ) ; g . setColor ( background [ 0 ] , background [ 1 ] , background [ 2 ] ) ; g . drawLine ( this . centerX , this . centerY , this . last_x , this . last_y ) ; var hand_color = this . color_fg_supplier ( ) ; g . setColor ( hand_color [ 0 ] , hand_color [ 1 ] , hand_color [ 2 ] ) ; var x2 = this . centerX + this . length * Math . sin ( angle ) ; var y2 = this . centerY - this . length * Math . cos ( angle ) ; g . drawLine ( this . centerX , this . centerY , x2 , y2 ) ; this . last_x = x2 ; this . last_y = y2 ; this . angle = angle ; this . last_draw_time = new Date ( ) ; this . active = true ; return true ; } else { this . active = false ; return false ; } }
method to move the hand to a new angle
method to move the hand to a new angle
// first test to see of the angle called is beyond the tolerance // for a redraw // and then call the predicate to see if a redraw is needed // rub out the old hand line // Now draw the new hand line // and store the last draw details for the next call