function metroSlow() {
    var multiplier = 5;
    var now = getSceneTimeFromStart();
    var slowDown = now/4.0;
    if (now <= 4.0) {
        if (slowDown > 1.0) {
            slowDown = 1.0;
        }
        slowDown = 1.0-slowDown;
    } else if (now <= 7.0) {slowDown=0;}
    else {slowDown*=-0.1;}
    return [getSceneTimeFromStart()*multiplier*slowDown];
}
Demo.prototype.init = function()
{
    var start = 0;
    var duration = 65;
    var layer = 1;


    this.loader.addAnimation([
    { 
         "start": start, "duration": duration
        ,"layer": layer
        ,"fbo":{"name":"scrollerFbo","action":"begin"}
    }]);

    var textScale = 20;
    var scroller = "Jumalauta 18 years party will take place in beautiful Finland 24.-26.8.2018. We have plenty of features and compos like lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean posuere fringilla quam, ut dictum augue vestibulum eu. Quisque ullamcorper ornare odio id feugiat. Integer convallis dignissim lorem eu facilisis. Suspendisse bibendum malesuada interdum. Aenean eu dui eu elit tempus sollicitudin. Duis massa nibh, volutpat id tellus sed, feugiat vulputate ante. Integer tristique lectus porta sem tincidunt, sed molestie magna fermentum. Vestibulum ultricies dui a tellus eleifend, ut gravida eros vehicula. Fusce sollicitudin erat nisl, et molestie massa tempor eu. Cras hendrerit purus sit amet euismod blandit. Vestibulum vehicula turpis in pretium finibus. Morbi euismod nunc ac dictum dictum. Aliquam erat volutpat. Suspendisse interdum, risus id sagittis ultrices, sapien ligula pretium elit, in malesuada magna nisl nec felis. Donec sit amet odio finibus, condimentum urna pulvinar, euismod nisi. Pellentesque maximus finibus nisi eu hendrerit. Fusce lobortis, velit eget aliquet maximus, eros est facilisis nisl, pellentesque cursus elit lectus eget purus. Duis eget velit dui. Pellentesque non dictum tortor, quis iaculis turpis. Duis arcu sem, tempus sed ligula ut, sollicitudin elementum magna. Aenean scelerisque sodales scelerisque. Nulla a consequat nunc. Morbi eget sapien vitae est pellentesque sodales. Mauris non sollicitudin erat, non consequat erat. Aliquam quam magna, tincidunt eget pharetra ac, placerat.";
    this.loader.addAnimation([
    {
         "start": start, "duration": duration
        ,"layer": layer, "text":{"name":"arialbd.ttf","string":scroller}
        ,"scale": [
              {"x":textScale,"y":textScale}
        ]
        ,"color": [
              {"a":240}
        ]
        ,"position":[
            {"x":scroller.length*11*textScale,"y":getScreenHeight()*0.6}
            ,{"duration":180,"x":-scroller.length*10*textScale-getScreenWidth()*3}
        ]
    }]);

    this.loader.addAnimation(
    { 
         "start": start, "duration": duration
        ,"layer": layer
        ,"fbo":{"name":"scrollerFbo","action":"unbind"}
    });

    this.loader.addAnimation({
         "start": start, "duration":duration
        ,"layer": layer, "image": "metro.png"
    });
    this.loader.addAnimation({
         "start": start, "duration":duration
        ,"layer": layer, "image": "metroloop.png"
        ,"position":[
             {"x":getScreenWidth()*0.5,"y":getScreenHeight()*0.555}
        ]
        ,"scale": [{"x":1.0}]
        ,"shader":{"name":"loop.fs"
            ,"variable":[
                 {"name":"time2","value":"{return metroSlow();}"}
            ]
        }
    });

    this.loader.addAnimation({
         "start": start+3, "duration":duration
        ,"layer": layer, "image": "metrologo.png"
        ,"scale":[{"uniform2d":2.05}]
        ,"position":[
             {"x":getScreenWidth()*0.5,"y":getScreenHeight()*0.5}
            ,{"duration":1}
            ,{"duration":1,"x":getScreenWidth()*0.2}
        ]
        ,"color":[{"a":255},{"duration":9},{"duration":1,"a":0}]
    });

    this.loader.addAnimation(
    {
         "start": start+3, "duration": duration
        ,"layer": layer, "text":{"name":"arialbd.ttf","string":"J"}
        ,"scale": [
              {"uniform2d":14}
        ]
        ,"position":[
             {"x":getScreenWidth()*0.5,"y":getScreenHeight()*0.5}
            ,{"duration":1}
            ,{"duration":1,"x":getScreenWidth()*0.2}
        ]
        ,"color":[{"a":255},{"duration":9},{"duration":1,"a":0}]
    });



    this.loader.addAnimation({
         "start": start+3, "duration":duration
        ,"layer": layer, "image": "metrologo.png"
        ,"scale":[{"uniform2d":2.05}]
        ,"position":[
             {"x":getScreenWidth()*0.5,"y":getScreenHeight()*0.5}
            ,{"duration":4.5}
            ,{"duration":1,"x":getScreenWidth()*0.8}
        ]
        ,"color":[{"a":255},{"duration":9},{"duration":1,"a":0}]
    });

    this.loader.addAnimation(
    {
         "start": start+3, "duration": duration
        ,"layer": layer, "text":{"name":"arialbd.ttf","string":"L"}
        ,"scale": [
              {"uniform2d":14}
        ]
        ,"position":[
             {"x":getScreenWidth()*0.5,"y":getScreenHeight()*0.5}
            ,{"duration":4.5}
            ,{"duration":1,"x":getScreenWidth()*0.8}
        ]
        ,"color":[{"a":255},{"duration":9},{"duration":1,"a":0}]
    });

    this.loader.addAnimation({
         "start": start+2, "duration":duration
        ,"layer": layer, "image": "metrologo.png"
        ,"scale":[{"uniform2d":2.05}]
        ,"position":[
            {"x":getScreenWidth()*0.5,"y":getScreenHeight()*0.5}
        ]
        ,"color":[{"a":0},{"duration":1,"a":255},{"duration":9},{"duration":1,"a":0}]
    });

    this.loader.addAnimation(
    {
         "start": start+2, "duration": duration
        ,"layer": layer, "text":{"name":"arialbd.ttf","string":"M"}
        ,"scale": [
              {"uniform2d":14}
        ]
        ,"position":[
            {"x":getScreenWidth()*0.5,"y":getScreenHeight()*0.5}
        ]
        ,"color":[{"a":0},{"duration":1,"a":255},{"duration":9},{"duration":1,"a":0}]
    });

    this.loader.addAnimation([
    {
         "start": start, "duration": duration
        ,"layer": layer
        ,"image": "scrollerFbo.color.fbo"
        ,"shader":{"name":"smoky.fs"}
    }]);

/*
*/
    var texts = [
        {
            "start":30, "duration":4, "lines":[
                "Unfortunately the demo",
                "did not finish in time"
            ]
        },{
            "start":34, "duration":10, "lines":[
                "There were unexpected",
                "delays in",
                "creation of 3d objects",
                "budget",
                "ideas"
            ]
        },{
            "start":44, "duration":8, "lines":[
                "The demo is expected",
                "to be ready in",
                "Graffathon 2021"
            ]
        },{
            "start":60, "duration":120, "lines":[
                "You should've",
                "pressed Escape",
                "by now"
            ]
        }
    ];


    var textScale = 4.0;
    for (var i = 0; i < texts.length; i++) {
        var text = texts[i];
        var yh = ((text.lines.length)*textScale*40)/2.0;
        for (var j = 0; j < text.lines.length; j++) {
            var ydelta = (text.lines.length-j)*textScale*40;
            this.loader.addAnimation([
            {
                 "start": text.start, "duration": text.duration
                ,"layer": layer, "text":{"name":"arialbd.ttf","string":text.lines[j]}
                ,"scale": [
                      {"x":textScale,"y":textScale}
                ]
                ,"position": [{"x":getScreenWidth()/2.0, "y":getScreenHeight()/2.0+ydelta-yh}]
                ,"color": [
                     {"a":0}
                    ,{"duration":1,"a":255}
                    ,{"duration":text.duration-2}
                    ,{"duration":1,"a":0}]
            }]);
        }
    }

    this.loader.addAnimation({
         "start": 12, "duration":duration
        ,"layer": layer, "image": "boat.png"
        ,"position":[{"x":-350,"y":200},{"duration":30,"x":getScreenWidth()+350}]
        ,"angle":[{"degreesZ":"{return Math.sin(getSceneTimeFromStart())*5-10;}"}]
    });
}
