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 ballRadius;
      6 
      7 function drawBallInit(diameter) {
      8   ballRadius = diameter / 2;
      9 }
     10 
     11 function drawBall(x, y, angle) {
     12   canvasContext.save();
     13   canvasContext.fillStyle = 'blue';
     14   canvasContext.translate(x, y);
     15   canvasContext.rotate(angle);
     16   canvasContext.fillRect(-ballRadius, -ballRadius, ballDiameter, ballDiameter);
     17   canvasContext.restore();
     18 }
     19