	
var gl = new WebGL2RenderingContext(); //enable WebGL 2 partial support

var images = {};
var warPos=[200,-50,-40,-110,-100,-50,200];
var tick= 0.08333333333;
var beat = 8*tick;
var pattern = 8*beat;
var postCreditsTime=47.5*pattern;

var introSceneTime = 0*pattern;
var partySceneTime = 4*pattern;

var particleMesh = void null;
	var fftImage = new Image();



Demo.prototype.init = function()
{
	
	Sync.addSync(
	[
		 { "name":"Sync1", "type":"rocket" },
		 { "name":"PanX1", "type":"rocket" },
		 { "name":"PanY1", "type":"rocket" },
		 { "name":"Scale1", "type":"rocket" },
		 { "name":"Alpha1", "type":"rocket" },
		 { "name":"PanX2", "type":"rocket" },
		 { "name":"PanY2", "type":"rocket" },
		 { "name":"Scale2", "type":"rocket" },
		 { "name":"Alpha2", "type":"rocket" },
		 { "name":"AlphaMin", "type":"rocket" },
		 { "name":"AlphaMax", "type":"rocket" },
		 { "name":"GlitchAMT", "type":"rocket" },
		 { "name":"GlitchSPEED", "type":"rocket" },
		 { "name":"GlitchOFFSET", "type":"rocket" },
		 { "name":"FarjanRot", "type":"rocket" }
		 		 
	]);
    var start = 0;
    var duration = 60*20;
    var layer = 1; 


	fftImage.load("fft0");
	
	//fbot
	this.createFBO(0,10000,"fbo20k");
	this.createFBO(10003,20000,"fbo20k");
	this.createFBO(20003,30000,"fbo30k");
	this.createFBO(30003,40000,"fbo40k");

	
	
	this.loader.addAnimation
	([{
		 "start": 0, "duration": 8888
		,"image": ["fbo20k.color.fbo","fft0"]
		,"layer": 40006
		,"position":[{"x":"{return Math.random()*10-10+640;}","y":"{return Math.random()*10-10+360;}"}]
		,"scale":[{"x":1,"y":1}]
		,"shader":{"name":["fftdistort.fs"]}


	}]);

   	this.loader.addAnimation
	([{
		"start": 0.0, "duration": 8888
		,"image": ["fbo30k.color.fbo", "fft0"]
		,"layer": 40007
		,"color":[{"r":255,"g":255,"b":255,"a":255}]
		,"position":[{"x":640,"y":360,"z":1}]
		,"shader":{"name":["fftdistort.fs"]}
	}]); 
	
	this.loader.addAnimation ([
	{
		"start": 0, "duration": 8888
		,"image": ["fbo40k.color.fbo"]
		,"layer": 40105
		,"position":[{"x":"{return Math.random()*10-10+640;}","y":"{return Math.random()*10-10+360;}"}]
		,"color":[{"r":255,"g":255,"b":255,"a":"{return 255*Sync.getSyncValue('Sync1');}"}]

	}]);
	
	this.createFBO(40005,52000,"fbolut");
	this.createFBO(60005,62000,"fboglow");

	this.loader.addAnimation
	([{
		"start": 0, "duration": 8888
		,"image": ["fbolut.color.fbo","2dlut.png"]
		,"layer": 60105
		,"shader":{
			"name":"lut.fs",
			"variable":
			[
				{"name":"lut","type":"int","value":[1]}
			]
		}
	}]);

	this.loader.addAnimation
	([{
		"start": 0, "duration": 8888
		,"image": ["fboglow.color.fbo"]
		,"layer": 70105
		,"shader":{
			"name":"glow.fs",
			"variable":
			[
				{"name":"lut","type":"int","value":[1]}
			]
		}
	}]);
   	this.loader.addAnimation([{
		"start": introSceneTime, "duration": 4*pattern ,"layer": 10400,			
		"text":
		{
			"string":"JUMA"	
			,"name":"font.ttf"
		}
		,"scale":[{"uniform3d":3.9}]
		,"position":[{"x":1280,"y":590,"z":1}
			,{"duration":3*pattern,x:425}
		]
		,"angle":[{"degreesZ":0}]
		,"shader":{"name":["textblur.fs"]}
	}]);

   	this.loader.addAnimation([{
		"start": introSceneTime, "duration": 4.0*pattern ,"layer": 10400,			
		"text":
		{
			"string":"LAUTA"	
			,"name":"font.ttf"
		}
		,"scale":[{"uniform3d":3.9}]
		,"position":[{"x":0,"y":590,"z":1}
			,{"duration":3*pattern,x:850}
		]
		,"angle":[{"degreesZ":0}]
		,"shader":{"name":["textblur.fs"]}
	}]);

   	this.loader.addAnimation([{
		"start": introSceneTime, "duration": 4.0*pattern ,"layer": 10400,			
		"text":
		{
			"string":"OR PO"	
			,"name":"font.ttf"
		}
		,"scale":[{"uniform3d":25.9}
			,{"duration":3*pattern,"uniform3d":6}]
		,"position":[{"x":640,"y":390,"z":1}
		]
		,"angle":[{"degreesZ":0}]
		,"shader":{"name":["textblur.fs"]}
	}]);
	
	   	this.loader.addAnimation([{
		"start": introSceneTime, "duration": 4.0*pattern ,"layer": 10300,			
		"text":
		{
			"string":"I"	
			,"name":"font.ttf"
		}
		,"scale":[{"uniform3d":0.0}
			,{"duration":3*pattern,"uniform3d":12}]
		,"position":[{"x":640,"y":390,"z":1}]
		,"color":[{"r":0,"g":0,"b":255}]
		,"angle":[{"degreesZ":0}]
		,"shader":{"name":["textblur.fs"]}
	}]);
	
	this.loader.addAnimation([{
         "start": 0, "duration": 22*pattern, "layer": 30010
        ,"image": ["data/white.png"]
		,"color":[{"r":"{return 255*(5*getSceneTimeFromStart()%1.0);}","g":"{return 255*(5*getSceneTimeFromStart()%1.0);}","b":"{return 255*(5*getSceneTimeFromStart()%1.0);}"}]
		,"scale":[{"uniform3d":16.0}]
	}]);
   
	this.loader.addAnimation([{
         "start": partySceneTime, "duration": 2*pattern, "layer": 20105
        ,"image": ["data/img_liberty.png"]
		,"angle":[{"degreesZ":-1}]
		,"scale":[{"x":"{return Sync.getSyncValue('Scale1');}","y":"{return Sync.getSyncValue('Scale1');}"}]
		,"position":[{"x":"{return Math.random()*15+Sync.getSyncValue('PanX1');}","y":"{return Math.random()*15+Sync.getSyncValue('PanY1');}"}]
		,"shader":{
			"name":"glitch.fs",
			"variable":
			[
				{"name":"time","type":"float","value":["{return getSceneTimeFromStart();}"]},
				{"name":"AMT","type":"float","value":["{return Sync.getSyncValue('GlitchAMT');}"]},
				{"name":"OFFSET","type":"float","value":["{return Sync.getSyncValue('GlitchOFFSET');}"]},
				{"name":"SPEED","type":"float","value":["{return Sync.getSyncValue('GlitchSPEED');}"]},
			]
		}
   }]);
   
	this.loader.addAnimation([{
         "start": partySceneTime+2*pattern, "duration": 2*pattern, "layer": 20105
        ,"image": ["data/img_orpohitler.png"]
		,"angle":[{"degreesZ":-1}]
		,"scale":[{"x":"{return Sync.getSyncValue('Scale1');}","y":"{return Sync.getSyncValue('Scale1');}"}]
		,"position":[{"x":"{return Math.random()*15+Sync.getSyncValue('PanX1');}","y":"{return Math.random()*15+Sync.getSyncValue('PanY1');}"}]
		,"shader":{
			"name":"glitch.fs",
			"variable":
			[
				{"name":"time","type":"float","value":["{return getSceneTimeFromStart();}"]},
				{"name":"AMT","type":"float","value":["{return Sync.getSyncValue('GlitchAMT');}"]},
				{"name":"OFFSET","type":"float","value":["{return Sync.getSyncValue('GlitchOFFSET');}"]},
				{"name":"SPEED","type":"float","value":["{return Sync.getSyncValue('GlitchSPEED');}"]},
			]
		}
   }]);
   
	this.loader.addAnimation([{
         "start": partySceneTime+4*pattern, "duration": 2*pattern, "layer": 20105
        ,"image": ["data/img_purrahitler.png"]
		,"angle":[{"degreesZ":-1}]
		,"scale":[{"x":"{return Sync.getSyncValue('Scale1');}","y":"{return Sync.getSyncValue('Scale1');}"}]
		,"position":[{"x":"{return Math.random()*15+Sync.getSyncValue('PanX1');}","y":"{return Math.random()*15+Sync.getSyncValue('PanY1');}"}]
		,"shader":{
			"name":"glitch.fs",
			"variable":
			[
				{"name":"time","type":"float","value":["{return getSceneTimeFromStart();}"]},
				{"name":"AMT","type":"float","value":["{return Sync.getSyncValue('GlitchAMT');}"]},
				{"name":"OFFSET","type":"float","value":["{return Sync.getSyncValue('GlitchOFFSET');}"]},
				{"name":"SPEED","type":"float","value":["{return Sync.getSyncValue('GlitchSPEED');}"]},
			]
		}
   }]);
  

   
   
	this.loader.addAnimation([{
         "start": partySceneTime+6*pattern, "duration": 2*pattern, "layer": 20105
        ,"image": ["data/img_purrasiitoin.png"]
		,"angle":[{"degreesZ":-1}]
		,"scale":[{"x":"{return Sync.getSyncValue('Scale1');}","y":"{return Sync.getSyncValue('Scale1');}"}]
		,"position":[{"x":"{return Math.random()*15+Sync.getSyncValue('PanX1');}","y":"{return Math.random()*15+Sync.getSyncValue('PanY1');}"}]
		,"shader":{
			"name":"glitch.fs",
			"variable":
			[
				{"name":"time","type":"float","value":["{return getSceneTimeFromStart();}"]},
				{"name":"AMT","type":"float","value":["{return Sync.getSyncValue('GlitchAMT');}"]},
				{"name":"OFFSET","type":"float","value":["{return Sync.getSyncValue('GlitchOFFSET');}"]},
				{"name":"SPEED","type":"float","value":["{return Sync.getSyncValue('GlitchSPEED');}"]},
			]
		}
   }]);   
 
	this.loader.addAnimation([{
         "start": partySceneTime+8*pattern, "duration": 2*pattern, "layer": 20105
        ,"image": ["data/img_essayah_dragonslayer.png"]
		,"angle":[{"degreesZ":0}]
		,"scale":[{"x":"{return Sync.getSyncValue('Scale1');}","y":"{return Sync.getSyncValue('Scale1');}"}]
		,"position":[{"x":"{return Math.random()*15+Sync.getSyncValue('PanX1');}","y":"{return Math.random()*15+Sync.getSyncValue('PanY1');}"}]
		,"shader":{
			"name":"glitch.fs",
			"variable":
			[
				{"name":"time","type":"float","value":["{return getSceneTimeFromStart();}"]},
				{"name":"AMT","type":"float","value":["{return Sync.getSyncValue('GlitchAMT');}"]},
				{"name":"OFFSET","type":"float","value":["{return Sync.getSyncValue('GlitchOFFSET');}"]},
				{"name":"SPEED","type":"float","value":["{return Sync.getSyncValue('GlitchSPEED');}"]},
			]
		}
   }]);
	this.loader.addAnimation([{
         "start": partySceneTime+10.5*pattern, "duration": 1.5*pattern, "layer": 20106
        ,"image": ["data/img_essayah_kkk.png"]
		,"angle":[{"degreesZ":0}]
		,"scale":[{"x":"{return Sync.getSyncValue('Scale1');}","y":"{return Sync.getSyncValue('Scale1');}"}]
		,"position":[{"x":"{return Math.random()*15+Sync.getSyncValue('PanX1');}","y":"{return -20+Math.random()*15+Sync.getSyncValue('PanY1');}"}]
		,"shader":{
			"name":"glitch.fs",
			"variable":
			[
				{"name":"time","type":"float","value":["{return getSceneTimeFromStart();}"]},
				{"name":"AMT","type":"float","value":["{return Sync.getSyncValue('GlitchAMT');}"]},
				{"name":"OFFSET","type":"float","value":["{return Sync.getSyncValue('GlitchOFFSET');}"]},
				{"name":"SPEED","type":"float","value":["{return Sync.getSyncValue('GlitchSPEED');}"]},
			]
		}
   }]);
	this.loader.addAnimation([{
         "start": partySceneTime+10*pattern, "duration": 2*pattern, "layer": 20105
        ,"image": ["data/img_kkk_bg.png"]
		,"angle":[{"degreesZ":0}]
		,"scale":[{"x":"{return 1.15*Sync.getSyncValue('Scale1');}","y":"{return Sync.getSyncValue('Scale1');}"}]
		,"position":[{"x":"{return Math.random()*15+Sync.getSyncValue('PanX1');}","y":"{return Math.random()*15+Sync.getSyncValue('PanY1');}"}]
		,"shader":{
			"name":"glitch.fs",
			"variable":
			[
				{"name":"time","type":"float","value":["{return getSceneTimeFromStart();}"]},
				{"name":"AMT","type":"float","value":["{return Sync.getSyncValue('GlitchAMT');}"]},
				{"name":"OFFSET","type":"float","value":["{return Sync.getSyncValue('GlitchOFFSET');}"]},
				{"name":"SPEED","type":"float","value":["{return Sync.getSyncValue('GlitchSPEED');}"]},
			]
		}
   }]);
   
   	this.loader.addAnimation([{
         "start": partySceneTime+12.0*pattern, "duration": 2*pattern, "layer": 20106
        ,"image": ["data/img_laivainterior.png"]
		,"angle":[{"degreesZ":0}]
		,"scale":[{"x":"{return Sync.getSyncValue('Scale1');}","y":"{return Sync.getSyncValue('Scale1');}"}]

		,"position":[{"x":"{return Math.random()*15+Sync.getSyncValue('PanX1');}","y":"{return Math.random()*15+Sync.getSyncValue('PanY1');}"}]
		,"shader":{
			"name":"glitch.fs",
			"variable":
			[
				{"name":"time","type":"float","value":["{return getSceneTimeFromStart();}"]},
				{"name":"AMT","type":"float","value":["{return Sync.getSyncValue('GlitchAMT');}"]},
				{"name":"OFFSET","type":"float","value":["{return Sync.getSyncValue('GlitchOFFSET');}"]},
				{"name":"SPEED","type":"float","value":["{return Sync.getSyncValue('GlitchSPEED');}"]},
			]
		}
   }]);
   
    this.loader.addAnimation([{
         "start": partySceneTime+12.0*pattern, "duration": 2*pattern, "layer": 20107
        ,"image": ["data/img_amh.png"]
		,"angle":[{"degreesZ":0}]
		,"scale":[{"x":"{return Sync.getSyncValue('Scale1');}","y":"{return Sync.getSyncValue('Scale1');}"}]
		,"position":[{"x":"{return Math.random()*15+Sync.getSyncValue('PanX1');}","y":"{return Math.random()*15+Sync.getSyncValue('PanY1');}"}]
		,"shader":{
			"name":"glitch.fs",
			"variable":
			[
				{"name":"time","type":"float","value":["{return getSceneTimeFromStart();}"]},
				{"name":"AMT","type":"float","value":["{return Sync.getSyncValue('GlitchAMT');}"]},
				{"name":"OFFSET","type":"float","value":["{return Sync.getSyncValue('GlitchOFFSET');}"]},
				{"name":"SPEED","type":"float","value":["{return Sync.getSyncValue('GlitchSPEED');}"]},
			]
		}
   }]);
 
    this.loader.addAnimation([{
         "start": partySceneTime+15.0*pattern, "duration": 2*pattern, "layer": 20107
        ,"image": ["data/img_rkpsun.png"]
		,"angle":[{"degreesZ":"{return 30*getSceneTimeFromStart();}"}]
		,"scale":[{"x":.75,"y":.75}]
		,"position":[{"x":1100,"y":600}]

   }]); 
 
    this.loader.addAnimation([{
         "start": partySceneTime+14.0*pattern, "duration": 2*pattern, "layer": 20107
        ,"image": ["data/img_rkpline.png"]
		,"angle":[{"degreesZ":"{return Sync.getSyncValue('FarjanRot');}"}]
		,"scale":[{"x":"{return Sync.getSyncValue('Scale1');}","y":"{return Sync.getSyncValue('Scale1');}"}]
		,"position":[{"x":"{return Math.random()*15+Sync.getSyncValue('PanX1');}","y":"{return -50+Math.random()*15+Sync.getSyncValue('PanY1');}"}]
		,"shader":{
			"name":"glitch.fs",
			"variable":
			[
				{"name":"time","type":"float","value":["{return getSceneTimeFromStart();}"]},
				{"name":"AMT","type":"float","value":["{return Sync.getSyncValue('GlitchAMT');}"]},
				{"name":"OFFSET","type":"float","value":["{return Sync.getSyncValue('GlitchOFFSET');}"]},
				{"name":"SPEED","type":"float","value":["{return Sync.getSyncValue('GlitchSPEED');}"]},
			]
		}
   }]); 
   
    this.loader.addAnimation([{
         "start": partySceneTime+15.0*pattern, "duration": 1*pattern, "layer": 20108
        ,"image": ["data/img_sea.png"]
		,"angle":[{"degreesZ":0}]
		,"scale":[{"x":1.6,"y":1.6}]
		,"position":[{"x":640,"y":"{return 80+Math.random()*15;}"}]
		,"shader":{
			"name":"waterscroll.fs",
			"variable":
			[
				{"name":"tim3","type":"float","value":["{return .05*getSceneTimeFromStart();}"]}
			]
		}

   }]); 
   
       this.loader.addAnimation([{
         "start": partySceneTime+16.0*pattern, "duration": 8 *pattern, "layer": 20107
        ,"image": ["data/img_vinyl.png"]
		,"angle":[{"degreesZ":"{return 50*getSceneTimeFromStart();}"}]
		,"scale":[{"x":"{return Sync.getSyncValue('Scale1');}","y":"{return Sync.getSyncValue('Scale1');}"}]
		,"position":[{"x":"{return Math.random()*15+Sync.getSyncValue('PanX1');}","y":"{return Math.random()*15+Sync.getSyncValue('PanY1');}"}]
 
   }]);
   
          this.loader.addAnimation([{
         "start": partySceneTime+16.0*pattern, "duration": 8 *pattern, "layer": 20108
		         ,"image": ["data/img_needle.png"]
		,"angle":[{"degreesZ":0}]

		,"scale":[{"x":"{return Sync.getSyncValue('Scale1');}","y":"{return Sync.getSyncValue('Scale1');}"}]
		,"position":[{"x":"{return Math.random()*15+Sync.getSyncValue('PanX1');}","y":"{return Math.random()*15+Sync.getSyncValue('PanY1');}"}]
 
   }]); 
   // BG EFFECTS
   
	this.loader.addAnimation([{
         "start": partySceneTime, "duration": 4*pattern, "layer": 10105
        ,"image": ["data/img_kokoomuscircle.png"]
		,"angle":[{"degreesZ":"{return 5*getSceneTimeFromStart();}"}]
		,"scale":[{"x":2,"y":2}]
		,"shader":{
			"name":"mirrorscroll.fs",
			"variable":
			[
				{"name":"tim3","type":"float","value":["{return .05*getSceneTimeFromStart();}"]}
			]
		}
	}]);
	
	this.loader.addAnimation([{
         "start": partySceneTime+8*pattern, "duration": 4*pattern, "layer": 10105
        ,"image": ["data/img_kdlogo.png"]
		,"angle":[{"degreesZ":"{return 15*getSceneTimeFromStart();}"}]
		,"scale":[{"x":6,"y":6}]
		,"shader":{
			"name":"tunnel.fs",
			"variable":
			[
				{"name":"tim3","type":"float","value":["{return .05*getSceneTimeFromStart();}"]}
			]
		}
	}]);

	this.loader.addAnimation([{
         "start": partySceneTime+4*pattern, "duration": 4*pattern, "layer": 10105
        ,"image": ["data/img_peruslogo.png"]
		,"angle":[{"degreesZ":"{return 15*getSceneTimeFromStart();}"}]
		,"scale":[{"x":2,"y":2}]
		,"shader":{
			"name":"zoomer.fs",
			"variable":
			[
				{"name":"tim3","type":"float","value":["{return 2.0*getSceneTimeFromStart();}"]}
			]
		}
	}]);
	
	this.loader.addAnimation([{
         "start": partySceneTime+12.0*pattern, "duration": 12*pattern, "layer": 10106
        ,"image": ["data/img_laivainterior.png"]
		,"angle":[{"degreesZ":0}]

		,"shader":{
			"name":"starfield.fs",
			"variable":
			[
				{"name":"tim3","type":"float","value":["{return getSceneTimeFromStart();}"]}
			]
		}
   }]);
   
	this.createText(0,1*pattern,"DEMOKRATIA", 5.0,0);

	this.createText(2*pattern,2*pattern,"KANSAN", 5.0,100);
	this.createText(2*pattern,2*pattern,"TAHTO", 5.0,0);

	this.createText(5*pattern,1*pattern,"NYT", 4.0,100);
	this.createText(5*pattern,1*pattern,"ON", 4.0,00);
	this.createText(5*pattern,1*pattern,"OIKEA", 4.0,-100);
	this.createText(5*pattern,1*pattern,"AIKA", 4.0,-200);


	this.createText(4*pattern,.5*pattern,"SIVISTYSPUOLUE", 3.6,00);
	this.createText(4.5*pattern,.5*pattern,"VAPAUS", 3.6,00);

	this.createText(6*pattern,1*pattern,"SYDÄN", 4.0,100);
	this.createText(6*pattern,1*pattern,"ON", 4.0,00);
	this.createText(6*pattern,1*pattern,"OIKEALLA", 4.0,-100);

	this.createText(7*pattern,1*pattern,"NOLLATOLERANSSI", 3.2,00);
	this.createText(7.0*pattern,.75*pattern,"290825", 3.2,-300);
	this.createText(8.75*pattern,.25*pattern,"SAAT MITÄ TILAAT", 3.2,00);
	
	this.createText(8.5*pattern,.25*pattern,"PELASTA SUOMI", 3.2,00);

	this.createText(9.0*pattern,1*pattern,"MINUN", 3.2,100);
	this.createText(9.0*pattern,1*pattern,"KAUNIS", 3.2,00);
	this.createText(9.0*pattern,1*pattern,"SUOMENI", 3.2,-100);
		
	this.createText(10.0*pattern,1*pattern,"JOTAIN RAJAA", 3.2,00);

	this.createText(12.0*pattern,1*pattern,"JÄRJEN ÄÄNI", 3.2,00);
	this.createText(13.0*pattern,1*pattern,"ENEMMÄN", 3.2,100);
	this.createText(13.0*pattern,1*pattern,"HYVINVOINTIA", 3.2,00);
		
	this.createText(14.0*pattern,1*pattern,"SUOMI", 3.2,100);
	this.createText(14.0*pattern,1*pattern,"JOHON", 3.2,00);
	this.createText(14.0*pattern,1*pattern,"VOIT", 3.2,-100);
	this.createText(14.0*pattern,1*pattern,"LUOTTAA", 3.2,-200);

	this.createText(15.0*pattern,1*pattern,"KOTI", 3.2,100);
	this.createText(15.0*pattern,1*pattern,"USKONTO", 3.2,00);
	this.createText(15.0*pattern,1*pattern,"ISÄNMAA", 3.2,-100);

	this.createText(16.0*pattern,1*pattern,"LÄHELLÄ SINUA", 3.2,00);
	
	this.createText(17.0*pattern,1*pattern,"RIKKAAMMAN", 3.2,100);
	this.createText(17.0*pattern,1*pattern,"SUOMEN", 3.2,00);
	this.createText(17.0*pattern,1*pattern,"PUOLESTA", 3.2,-100);

	this.createText(18.0*pattern,1*pattern,"YHDESSÄ", 3.2,100);
	this.createText(18.0*pattern,1*pattern,"ETEENPÄIN", 3.2,00);
		

	this.createText(19.0*pattern,.75*pattern,"TEHDÄÄN", 3.2,100);
	this.createText(19.0*pattern,.75*pattern,"SUOMESTA", 3.2,00);
	this.createText(19.0*pattern,.75*pattern,"NÄRPIÖ", 3.2,-100);
	this.createText(19.0*pattern,.75*pattern,"290825", 3.2,-300);

	this.createText(19.75*pattern,.75*pattern,"TASA-ARVOISTA", 3.2,100);
	this.createText(19.75*pattern,.75*pattern,"POLITIIKKAA", 3.2,00);

	
	
	this.loader.addAnimation([{
         "start": 1*pattern, "duration": 1*pattern, "layer": 30401
        ,"image": ["data/img_vote.png"]
		,"angle":[{"degreesZ":-1}]
		,"scale":[{"x":3,"y":3}]
		,"position":[{"x":"{return Math.random()*15+640;}","y":"{return -100+Math.random()*15+520;}"}]
		,"shader":{
			"name":"glitch.fs",
			"variable":
			[
				{"name":"time","type":"float","value":["{return getSceneTimeFromStart();}"]},
				{"name":"AMT","type":"float","value":["{return Sync.getSyncValue('GlitchAMT');}"]},
				{"name":"OFFSET","type":"float","value":["{return Sync.getSyncValue('GlitchOFFSET');}"]},
				{"name":"SPEED","type":"float","value":["{return Sync.getSyncValue('GlitchSPEED');}"]},
			]
		}
   }]);

	this.loader.addAnimation([{
         "start": partySceneTime+7*pattern, "duration": 1*pattern, "layer": 30401
        ,"image": ["data/img_arbeit.png"]
		,"angle":[{"degreesZ":-1}]
		,"scale":[{"x":1,"y":1}]
		,"position":[{"x":"{return Math.random()*15+640;}","y":"{return -100+Math.random()*25+520;}"}]
		,"shader":{
			"name":"glitch.fs",
			"variable":
			[
				{"name":"time","type":"float","value":["{return getSceneTimeFromStart();}"]},
				{"name":"AMT","type":"float","value":["{return Sync.getSyncValue('GlitchAMT');}"]},
				{"name":"OFFSET","type":"float","value":["{return Sync.getSyncValue('GlitchOFFSET');}"]},
				{"name":"SPEED","type":"float","value":["{return Sync.getSyncValue('GlitchSPEED');}"]},
			]
		}
   }]);

   
	this.loader.addAnimation([{
         "start": partySceneTime+5*pattern, "duration": .5*pattern, "layer": 30401
        ,"image": ["data/img_esso.png"]
		,"angle":[{"degreesZ":-1}]
		,"scale":[{"x":"{return 1.5*Sync.getSyncValue('Scale1');}","y":"{return 1.5*Sync.getSyncValue('Scale1');}"}]
		,"position":[{"x":"{return Math.random()*15+Sync.getSyncValue('PanX1');}","y":"{return -100+Math.random()*15+Sync.getSyncValue('PanY1');}"}]
		,"shader":{
			"name":"glitch.fs",
			"variable":
			[
				{"name":"time","type":"float","value":["{return getSceneTimeFromStart();}"]},
				{"name":"AMT","type":"float","value":["{return Sync.getSyncValue('GlitchAMT');}"]},
				{"name":"OFFSET","type":"float","value":["{return Sync.getSyncValue('GlitchOFFSET');}"]},
				{"name":"SPEED","type":"float","value":["{return Sync.getSyncValue('GlitchSPEED');}"]},
			]
		}
   }]);
   
}


Demo.prototype.createText = function (startTime, duration, textString, scale, yPos)
{
	   	this.loader.addAnimation([{
		"start": startTime, "duration": duration ,"layer": 30400,			
		"text":
		{
			"string":textString
			,"name":"font.ttf"
		}

		,"scale":[{"uniform3d":scale}]
		,"position":[{"x":640,"y":420+yPos,"z":1}		]
		,"angle":[{"degreesZ":0}]
		,"shader":{"name":["textblur2.fs"]}
		,"color":[{"r":0,"g":0,"b":0}]
	}]);
}
Demo.prototype.createFBO = function (startLayer, endLayer, name)
{
	   	this.loader.addAnimation ([
	{
	"start": 0, "duration": 99999
	,"layer": startLayer
	,"fbo":{"name":name,"action":"begin","storeDepth":true}
	}
	]);
	
	this.loader.addAnimation ([
	{
	"start": 0, "duration": 99999
	,"layer": endLayer,"fbo":{"name":name,"action":"unbind"}
	}
	]);
	
}

