Home | History | Annotate | Download | only in canvas2d_balls_common
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 var ballScale;
      6 
      7 function drawBallInit(diameter) {
      8   var metrics = canvasContext.measureText("Chrome");
      9   ballScale = diameter/metrics.width
     10 }
     11 
     12 function drawBall(x, y, angle) {
     13   canvasContext.save();
     14   canvasContext.fillStyle = 'blue';
     15   canvasContext.translate(x, y);
     16   canvasContext.rotate(angle);
     17   canvasContext.scale(ballScale, ballScale);
     18   canvasContext.textAlign = "center";
     19   canvasContext.fillText("Chrome", 0, 0);
     20   canvasContext.restore();
     21 }
     22