window.requestAnimFrame = (function(){ return window.requestAnimationFrame})();
var canvas = document.getElementById("space");
var c = canvas.getContext("2d");
var radius = '0.'+Math.floor(Math.random() * 9) + 1 ;
var focalLength = canvas.width *2;
requestAnimFrame(executeFrame);
function initializeStars(){
centerX = canvas.width / 2;
centerY = canvas.height / 2;
for(i = 0; i < numStars; i++){
x: Math.random() * canvas.width,
y: Math.random() * canvas.height,
z: Math.random() * canvas.width,
o: '0.'+Math.floor(Math.random() * 99) + 1
for(i = 0; i < numStars; i++){
var pixelX, pixelY, pixelRadius;
if(canvas.width != window.innerWidth || canvas.width != window.innerWidth){
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
{c.fillStyle = "rgba(0,0,0,1)";
c.fillRect(0,0, canvas.width, canvas.height);}
for(i = 0; i < numStars; i++){
pixelX = (star.x - centerX) * (focalLength / star.z);
pixelY = (star.y - centerY) * (focalLength / star.z);
pixelRadius = 1 * (focalLength / star.z);
c.fillRect(pixelX, pixelY, pixelRadius, pixelRadius);
c.fillStyle = "rgba(255, 255, 255, "+star.o+")";