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