Katamari Damacy a site
See: http://kotaku.com/#!5781311/run-a-katamari-all-over-this-and-any-site
by dhchow
JavaScript
javascript: var h = 'http://174.129.249.239/js/',
i, n, ss = ['http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js', h + 'Renderables.js', h + 'Game.js'];
for (i = 0; i < ss.length; i++) {
n = document.createElement("script");
n.src = ss[i] + '?' + Date.now();
document.head.appendChild(n);
}
// Renderables.js
var PRADIUS_MULT = 1.0;
var VOL_MULT = 0.1;
var MAX_ELEMENTS = 70;
function grid_obj_vol(grid_obj) {
return grid_obj.w * grid_obj.h * Math.min(grid_obj.w, grid_obj.h) * VOL_MULT;
}
function PlayerBall(is_controlled, userId) {
var x=300.0, y=300.0,
lastX, lastY,
vx=0.0, vy=0.0,
th=0.0, phi=0.0,
radius=20.0,
pradius=radius * PRADIUS_MULT, /**< pickup radius. */
canvas_el, canvas_ctx, /* for drawing the ball */
userColor = "#ff0000",
mouseX=0.0, mouseY=0.0, mouseTh=0.0,
docW=1000.0, docH=800.0,
lastR=0.0, /**< optimization to only resize when we need to. */
forward_down = false, backward_down = false,
attached = [], /**< list of attached objects. */
/* {e: element, th: atan2 of dir on pickup, r: radius on pickup,
* phi:
*/
next_send_in = 0;
this.is_controlled = is_controlled;
this.userId = userId;
function setUserColor(color) {
userColor = color;
var i;
for (i = 0; i < attached.length; i++) {
attached[i].e.style.border = "1px solid " + userColor;
}
}
this.setUserColor = setUserColor;
canvas_el = document.createElement("canvas");
canvas_el.width = "100";
canvas_el.height = "100";
canvas_el.style.cssText = "position:absolute;top:100px;left:100px;z-index:105;";
document.body.appendChild(canvas_el);
canvas_ctx = canvas_el.getContext('2d');
function draw() {
var i, o;
canvas_el.style.left = (x - radius) + 'px';
canvas_el.style.top =...