User:Backrooms Obsession/common.css

/*$('.blackhole').click(function {   $(this).toggleClass('open_blackhole');    $(this).toggleClass('close_blackhole'); });*/

// Define Apparatus Variables. var cw = window.innerWidth, ch = window.innerHeight, blackhole_entities = {}, blackhole_entitiesIndex = 0, blackhole_entitieAmount = 12000, //6000 blackhole_button = $('.blackhole'), canvas = $(' ').attr({       width: cw,        height: ch,        id: "apparatus"    }).appendTo('body'), context = canvas.get(0).getContext("2d");

var requestframe = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || // IE Fallback, you can even fallback to onscroll function(callback) { window.setTimeout(callback, 1000 / 60) };

// Default Entity "Class" apparatus.blackhole = function(orbit) { blackhole_entitiesIndex++; this.id = blackhole_entitiesIndex; blackhole_entities[blackhole_entitiesIndex] = this;

this.width = .5; this.height = .5; this.orbit = orbit;

this.velocity = Math.floor((Math.random * 3200) + 2500);

this.angle = (Math.PI * 2 / this.width) * Math.floor((Math.random * cw*4) + 10);; var choice = Math.random * 5;

var rands = []; rands.push(Math.random * 100 + 1); rands.push(Math.random * 10 + 241);

var choice2 = Math.random * 4;

var rands2 = []; rands2.push(Math.random * 100 + 1); rands2.push(Math.random * 180 + 211);

this.distance = (rands.reduce(function(p, c) { return p + c;   }, 0) / rands.length);

this.distance2 = (rands2.reduce(function(p, c) { return p + c;   }, 0) / rands2.length); this.increase = Math.PI * 2 / this.width;

this.distancefix = this.distance; this.distance2fix = this.distance2;

this.color = "255,255,255"; this.alpha = 0.6

this.bx = Math.random * 20 + 1; this.by = Math.random * 20 + 1; this.inplace = true; }

apparatus.blackhole.prototype.draw = function { if (this.orbit >= 2) { this.x = this.bx + this.distance * Math.cos(this.angle / this.velocity) + cw / 2; this.y = this.by + this.distance * Math.sin(this.angle / this.velocity) + ch / 2; this.alpha = 0.6; } else { this.x = this.bx + this.distance2 * Math.cos(this.angle / this.velocity) + cw / 2; this.y = this.by + this.distance2 * Math.sin(this.angle / this.velocity) + ch / 2; this.alpha = 0.4; }/*   if (blackhole_button.hasClass('open_blackhole')) { blackhole_button.removeClass('close_blackhole');

if (this.distance >= 171) { this.distance = this.distance - 4; } else if (this.distance <= 161) { this.distance= this.distance + 8; }

if (this.distance2 >= 201) { this.distance2 = this.distance2 - 6; } else if (this.distance2 <= 161) { this.distance2 = this.distance2 + 6; }   }    if(blackhole_button.hasClass('close_blackhole')){ if (this.distance >= this.distancefix + 4) { this.distance = this.distance - 4; } else if (this.distance <= this.distancefix - 5) { this.distance= this.distance + 5; }

if (this.distance2 >= this.distance2fix + 10) { this.distance2 = this.distance2 - 4; } else if (this.distance2 <= this.distance2fix - 10) { this.distance2 = this.distance2 + 4; }

}*/

this.angle += this.increase;

context.fillStyle = "rgba(" + this.color + "," + this.alpha + ")"; context.fillRect(this.x, this.y, this.width, this.height); }

apparatus.start = function { apparatus('true'); }

apparatus.stop = function { apparatus('false'); }

for (var i = 0; i < blackhole_entitieAmount; i++) { new apparatus.blackhole((Math.random * 5)); }

var mode; apparatus.spawn_blackhole = function{ for (i in blackhole_entities) { blackhole_entities[i].draw; } } function apparatus(mode) { if (mode == 'true') { var i;       requestframe(function {            context.clearRect(0, 0, cw, ch);

apparatus.spawn_blackhole;

apparatus('true'); });   } }

apparatus.start;