Edit in JSFiddle

(function() {
  var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
                              window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
  window.requestAnimationFrame = requestAnimationFrame;
})();

var N_STARS = 100;
var STAR_SIZE = 2;

var stars = [];

var canvas = document.getElementById('canvas');
if (canvas.getContext) {
    var ctx = canvas.getContext('2d');
    ctx.fillStyle = "white";

    //inicializacion
    var i;
    for(i=0; i<N_STARS; i++){
        stars.push({
            "x": Math.random() * canvas.width,
            "y": Math.random() * canvas.height 
        });
    }
        
    var draw = function () {
        //actualizacion
        for (i = 0; i < stars.length; i++) {
            stars[i].x = stars[i].x - (canvas.width / 2 - stars[i].x) * 0.1;
            stars[i].y = stars[i].y - (canvas.height / 2 - stars[i].y) * 0.1;
        }
        
        //dibujado
        ctx.clearRect(0, 0, canvas.width, canvas.height);
        for (i = 0; i < stars.length; i++) {
            ctx.fillRect(stars[i].x, stars[i].y, STAR_SIZE, STAR_SIZE);
        }
        
        requestAnimationFrame(draw);
    };
    requestAnimationFrame(draw);
}
<body>
    <canvas id="canvas" width="400" height="300"></canvas>
</body>
#canvas {
    background-color:black
}