* { margin:0; padding:0; } /* to remove the top and left whitespace */
html, body { width:100%; height:100%; }
#canvas{
width:100%;
height:100%;
display:block;
background:black;
}
JavaScript
var x = 150;
var y = 150;
var dx = 0;
var dy = 4;
var WIDTH;
var HEIGHT;
var ctx;
var s = 6;
var bounceCount = 0;
var paddlex;
var paddley;
var paddleW;
var ballRadius = 7;
var intervalId = 0;
var rightDown = false;
var leftDown = false;
var canvasMinX = 0;
var canvasMaxX = 0;
var FPS = 60;
//var paddleImage = new Image();
//var ballImage = new Image();
var paddle;
var ball;
var backgroundLayer;
var ballLayer;
var paddleLayer;
var tracerLayer;
var autoRun = true;
var paddleHighlightLayer;
var brickLayer;
var paused = false;
var base64Sources = [
...
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.