/** @license Copyright 2011 Chad Schouggins - Team Four Technology
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// exported symbols
/** @ignore */ $ = window.$ || null; // will be remove during compilation, avoids conflicts with jquery which otherwise may rename a function to $()
window["init"] = init;
// key codes
/** @const @type {number} */ var KEY_LEFT = 37;
/** @const @type {number} */ var KEY_RIGHT = 39;
/** @const @type {number} */ var KEY_A = 65;
/** @const @type {number} */ var KEY_D = 68;
/** @const @type {number} */ var KEY_SPACE = 32;
// table attributes
/** @const @type {number} */ var TABLE_HEIGHT = 600;
/** @const @type {number} */ var TABLE_WIDTH = 600;
/** @const @type {number} */ var TABLE_RADIUS = 225; // distance between center of table and paddles.
/** @const @type {Object.<string, number>} */ var TABLE_CENTER = {x:TABLE_WIDTH / 2, y:TABLE_HEIGHT / 2}; // stored to prevent constantly calculating the center coords.
/** @const @type {number} */ var TABLE_RING_RADIUS = 263; // radius to determine end game
//ball attributes
/** @const @type {number} */ var BALL_RADIUS = 9; // radius of actual ball (used for collision)
/** @const @type {number} */ var BALL_RADIUS_GLOW = 16; // css value (actual image size) for use with display position
/** @const @type {number} */ var BALL_INIT_SPEED = 4;
/** @const @type {number} */ var BALL_ACCELERATION = 0.2;
/** @const @type {number} */ var BALL_MAX_SPEED = 10;
// paddle attributes
/** @const...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.