;(function(lander){
    console.log('Moon Lander Visualisation');

    var display = document.getElementById('display');
    var horizon = new Array(display.width);
    horizon[0] = 50;
    for (var index = 1; index < display.width; index++){
        horizon[index] = horizon[index - 1] + 2 * (Math.random() - 0.5);
    }

    var model = {
        "lander": {
            "x": 37, "y": 251,
            "vx": 0, "vy": 0,
            "orientation": Math.PI/4, "angular-velocity": 0,
            "radius": 10,
            "fuel": 1
        },
        "horizon": horizon
    };

    new lander.View(model, display);
})(lander);

;(function(lander){
    console.log('Moon Lander Visualisation');

    var display = document.getElementById('display');
    var horizon = new Array(display.width);
    horizon[0] = 50;
    for (var index = 1; index < display.width; index++){
        horizon[index] = horizon[index - 1] + 2 * (Math.random() - 0.5);
    }

    var model = {
        "lander": {
            "x": 37, "y": 251,
            "vx": 0, "vy": 0,
            "orientation": Math.PI/4, "angular-velocity": 0,
            "radius": 10,
            "fuel": 1
        },
        "horizon": horizon
    };

    var view = new lander.View(model, display);
    function tick(){
        view.update();
        requestAnimationFrame(tick);
    };
    tick();
})(lander);

Update view on each animation frame
Update view on each animation frame
