window.onload = main;

var d = document;
var de = d.documentElement;
var offset = 0;

function main() {
    console.log("JS loaded");
    setInterval(frame, 1000.0 / 60.0);
}

function frame() {
    if (offset >= (de.clientWidth)) {
        offset = -100;
    } else {
        offset += 3;
    }
    d.getElementById("carre").style.marginLeft = offset + "px";
}
