#####################################################
#                                                   #
#   HEADER                                          #
#                                                   #
#####################################################

header {
	title: Sky Cluster Prophecy by Matt Current
	width: 1280
	height: 720	
	music: pilgrimage.ogg
	bpm: 125.0
}

#####################################################
#                                                   #
#    OBJECTS                                        #
#                                                   #
#####################################################

textures {
	*bufCopy {
		width: 640
		height: 360
	}
	*glowX {
		width: 640
		height: 360
		wrap: clamp
	}
	*glow {
		width: 640
		height: 360
		wrap: clamp
	}
}

objects {
	cam: camera {
	}
	env: enviroment {
		lighting: 1
		light0.pos.y: 100
		light0.pos.x: 20
		light0.diffuse.r: 0.5
		light0.diffuse.g: 0.3
		light0.diffuse.b: 0.0
		light0.ambient.r: 0
		light0.ambient.g: 0
		light0.ambient.b: 0.01
	}
	backImg: image underwater.jpg, sky.jpg {
		stretch: yes
		col.r: 0
		col.g: 0
		col.b: 0
	}
	part4: Skycluster/particles4
	lines: Skycluster/lines
	obj1: 3ds palikkapallot.3ds {
		shader: build2.shader
		generateTexCoords: 1
		materials.default.blend: blend::alpha
		scale.x: 5
		scale.y: 5
		scale.z: 5
	}
	obj2: 3ds moukero.3ds {
		texture: default *glow
		shader: build2.shader
	}
	obj4: 3ds wreck.3ds {
		materials.default.envMap: 3ds::sphereMap
		texture: default skymap.jpg
	}
	obj5: 3ds torus.3ds {
		materials.default.envMap: 3ds::sphereMap
		texture: default *glow
	}
	obj6: 3ds roju1.3ds {
		materials.default.envMap: 3ds::sphereMap
		texture: default map2.jpg
	}
	obj7: 3ds roju2.3ds {
		materials.default.envMap: 3ds::sphereMap
		texture: default map2.jpg
		scale.x: 2.0
		scale.y: 2.0
		scale.z: 2.0
	}
	obj8: 3ds roju3.3ds {
		materials.default.envMap: 3ds::sphereMap
		texture: default map2.jpg
		scale.x: 3.0
		scale.y: 3.0
		scale.z: 3.0
	}
	obj9: 3ds roju4.3ds {
		materials.default.envMap: 3ds::sphereMap
		texture: default map2.jpg
		scale.x: 4.0
		scale.y: 4.0
		scale.z: 4.0
	}
	part1: Skycluster/particles {
		particleCount: 200000
		pointSize: 3
		radius: 25
	}
	part2: Skycluster/particles2
	part3: Skycluster/particles3
	cubes: Skycluster/lineCubes

	bufImgBlurX: image *bufCopy {
		shader: blurx.shader
		shader0.blur: 20
		stretch: yes
	}
	bufImgBlurY: image *glowX {
		stretch: yes
		shader: blury.shader
		shader0.blur: 20
	}
	bufImg: image *buf {
		stretch: yes
	}
	blurImg: image *glow {
		stretch: yes
		blend: blend::alpha
		col.a: 0.5
	}
	blurImg2: image *glow {
		stretch: yes
		blend: blend::screen
	}
	feedbackBlurImg: image *glow {
		stretch: yes
		blend: blend::screen
		col.a: 0.5
	}
	textImg: image {
		files: neurons.jpg, skin.jpg, sensories.jpg, blood.jpg, veins.jpg
		files: gasoline.jpg, racer.jpg, burning.jpg, cities.jpg, night.jpg
		files: falling.jpg, needlestorm.jpg, clusterfuck.jpg, concrete.jpg
		files: steel.jpg, crying.jpg, cause.jpg, effect.jpg
		stretch: yes
		blend: blend::screen
	}
	faderImg: image fademask.jpg title.jpg {
		shader: fader.frag
		stretch: true
		blend: blend::alpha
	}
	outputImg: image *mix {
		shader: tv.shader
		shader0.rgbfuck: 1
	}
}

#####################################################
#                                                   #
#    RENDER PASSES                                  #
#                                                   #
#####################################################

renderPasses {
	render {
		objects: cam, env, part1, part2, obj1, obj2, cubes, textImg, feedbackBlurImg, backImg, obj4, obj5, part3, part4, obj6, obj7, obj8, obj9, lines
		output: *buf
	}
	copyBuf {
		objects: bufImg
		output: *bufCopy
	}
	blurX {
		objects: bufImgBlurX
		output: *glowX
	}
	blurY {
		objects: bufImgBlurY
		output: *glow
	}
	main {
		objects: bufImg, blurImg, blurImg2, faderImg
		output: *mix
	}
	output {
		objects: outputImg
	}
	
}

#####################################################
#                                                   #
#    SCRIPT                                         #
#                                                   #
#####################################################

controllers {
	cam.pos.x
	cam.pos.y
	cam.pos.z
	cam.lookAt.x
	cam.lookAt.y
	cam.lookAt.z
	cam.shaking
	foo
	foo2
}

script {
	@0.0 enable cam, env, blurImg, blurImg2, bufImg, bufImgBlurX, bufImgBlurY, feedbackBlurImg, backImg, outputImg

	@0.0 env.light0.pos.y = 100
	@0.0 env.light0.pos.x = 50
	
	@0.0 outputImg.shader0.sharpen = eval("0.1+fft(120)*100") for 10000
	@0.0 outputImg.shader0.rgbfuck = eval("fft(20)^3*1000+1") for 10000
	
	# Setup camera
	@0.0 cam.pos.x = eval("ctrl('cam.pos.x')") for 10000
	@0.0 cam.pos.y = eval("ctrl('cam.pos.y')") for 10000
	@0.0 cam.pos.z = eval("ctrl('cam.pos.z')") for 10000
	#@0.0 cam.pos.x = eval("ctrl('cam.pos.x') + ctrl('cam.shaking') * sin(time*0.002) * 0.25") for 10000
	#@0.0 cam.pos.y = eval("ctrl('cam.pos.y') + ctrl('cam.shaking') * sin(time*0.0021) * 0.25") for 10000
	#@0.0 cam.pos.z = eval("ctrl('cam.pos.z') + ctrl('cam.shaking') * sin(time*0.0019) * 0.25") for 10000
	@0.0 cam.lookAt.x = eval("ctrl('cam.lookAt.x') + ctrl('cam.shaking') * sin(time*0.0043)") for 10000
	@0.0 cam.lookAt.y = eval("ctrl('cam.lookAt.y') + ctrl('cam.shaking') * sin(time*0.0041)") for 10000
	@0.0 cam.lookAt.z = eval("ctrl('cam.lookAt.z') + ctrl('cam.shaking') * sin(time*0.0049)") for 10000
	@0.0 ctrl.cam.shaking = 0.1
	
	# Run scenes
	@0.0 call scene_underwater1
	@8.0 call scene_cubes
	@16.0 call scene_splines
	@32.0 call scene_lyrics
	@48.0 call scene_underwater2
	
	@64.0 ctrl.cam.shaking = 0.01
	@64.0 call scene_wreck
	@80.0 call scene_wreck2

	@96.0 ctrl.cam.shaking = 0.1
	@110.0 ctrl.cam.shaking = 0.1 to 1.0 in @2.0
	@96.0 call scene_city

	@112.0 ctrl.cam.shaking = 0.2
	@112.0 call scene_cubes2
	
	@128.0 ctrl.cam.shaking = 0.2 to 0.1 in @16.0
	@128.0 call scene_torus
	@144.0 call scene_torus2
	
	@160.0 end
}

scene_underwater1 {
	@0.0 enable part1, faderImg
	@0.0 faderImg.shader0.threshold = 1 to -1 in @8.0
	@0.0 faderImg.zoom = 0 to 0.1 in @8.0
	@8.0 disable faderImg
	
	@0.0 part1.pointSize = 4
	@0.0 part1.brightness = 2.0

	@0.0 enable obj1
	@0.0 obj1.shader0.foo = 0.0 to 8 in @8.0
	@0.0 part1.anim = 0 to 8 in @8.0
	@0.0 part2.anim = 0 to 8 in @8.0
	@8.0 disable obj1

	@0.0 call cameraRun
	@0.0 loop @2.0 4 times {
		@0.0 cam.fovy = eval(" 90+sin(time*0.051)*30")
		@0.0 ctrl.cam.pos.x = eval(" sin(time*0.051)*15")
		@0.0 ctrl.cam.pos.z = eval(" cos(time*0.075)*15")
		@0.0 ctrl.cam.pos.y = eval(" cos(time*0.010)*15")
	}
	@0.0 part1.yellow = eval("fft(20)^2*10000") for @8.0

	@7.0 backImg.col.r = 0 to 1 in @1.0
	@8.0 disable part1
}

scene_underwater2 {
	@0.0 enable part1
	@0.0 part1.pointSize = 4
	@0.0 part1.brightness = 2.0
	
	@0.0 call obj1WithParticles( 50 )
	@0.0 call cameraRun
	@0.0 loop @2.0 8 times {
		@0.0 cam.fovy = eval("90+sin(time*0.051)*30")
		@0.0 cam.fovy = eval("70+sin(time*0.051)*30")
		@0.0 ctrl.cam.pos.x = eval(" sin(time*0.051)*25")
		@0.0 ctrl.cam.pos.z = eval(" cos(time*0.075)*25")
		@0.0 ctrl.cam.pos.y = eval(" cos(time*0.010)*25")
		@0.0 part1.yellow = eval("fft(20)^2*15000") for @1.0
		@1.0 part1.yellow = eval("fft(20)^2*25000") for @1.0
	}
	
	@0.0 backImg.frame = 1
	@0.0 loop @2.0 8 times {
		@0.0.5 backImg.col.r = 0.5 to 0 in @1.2
		@0.0.5 backImg.col.g = 0.5 to 0 in @0.3
		@0.0.5 backImg.col.b = 0.5 to 0 in @0.2
	}
	
	@0.0 enable lines
	@16.0 disable lines
	@0.0 lines.foo = eval("ctrl('foo2')") for @16.0
	@0.0 lines.mix = eval("ctrl('foo2')*0.01") for @16.0
	@0.0 loop @0.1 64 times {
		@0.0.5 ctrl.foo2 = rand( 0 to 100 )
	}
	
	@16.0 disable part1
}

scene_splines {
	@0.0 enable  part2, obj2

	@0.0 enable faderImg
	@0.0 faderImg.shader0.threshold = 1 to -1 in @2.0
	@0.0 faderImg.zoom = 0.5 to 0 in @2.0
	@2.0 disable faderImg

	@0.0 cam.fovy = spline(50, 50, 160, 200) in @16.0
	@0.0 ctrl.cam.pos.x = 0
	@0.0 ctrl.cam.pos.y = 0
	@0.0 ctrl.cam.pos.z = 0
	@0.0 ctrl.cam.lookAt.x = eval("sin(time*0.0001)*10") for @16.0
	@0.0 ctrl.cam.lookAt.y = eval("sin(time*0.0002)*10") for @16.0
	@0.0 ctrl.cam.lookAt.z = eval("sin(time*0.0003)*10") for @16.0

	@0.0 part2.end = 0 to 1 in @16.0
	@0.0 part2.begin = 0
	@15.0 part2.begin = 0 to 1 in @1.0
	@0.0 part2.anim = 0 to 20 in @16.0

	@0.0 loop @0.1 64 times {
		@0.0 part2.pointSize = 13 to 1 in @0.1
	}
	@0.0 obj1.shader0.foo = 0 to 10 in @16.0
	
	@0.0 backImg.col.r = 0.04 to 0.0 in @16.0
	@0.0 backImg.col.g = 0.1 to 0.0 in @15.0
	@0.0 backImg.col.b = 0.15 to 0.0 in @14.0

	@8.0 enable textImg
	@8.0 textImg.col.a = 0 to 0.25 in @4.0
	@12.0 textImg.col.a = 0.25 to 0 in @4.0
	@16.0 textImg.col.a = 1
	@8.0 textImg.col.g = 0.9
	@8.0 textImg.col.b = 0.0
	@8.0 textImg.zoom = 0.2 to 0 in @8.0

	@15.0 enable faderImg
	@15.0 faderImg.shader0.threshold = -1 to 1 in @1.0
	@15.0 faderImg.zoom = 1 to 0 in @1.0
	@16.0 disable faderImg
	
	@16.0 disable part1, part2, obj2
}

scene_lyrics {
	@0.0 disable obj1
	@0.0 call texts
	@15.0 call fuckup2
	@16.0 disable part2
}

scene_cubes {
	@0.0 enable part1, cubes, obj2
	@0.0 cubes.foo = 0 to 5 in @8.0
	@0.0 cam.fovy = 90
	@0.0 loop @2.0 4 times {
		@0.0 ctrl.cam.pos.x = eval(" sin(time*0.271)*20")
		@0.0 ctrl.cam.pos.z = eval(" cos(time*0.975)*10")
		@0.0 ctrl.cam.pos.y = eval(" cos(time*0.510)*10")
	}
	@0.0 cubes.foo2 = eval("cos(time*0.0001)*3") for @8.0
	@0.0 part1.anim = 0 to 5 in @8.0
	@0.0 part1.pointSize = 3.0
	@0.0 part1.yellow = eval("fft(20)^2*10000") for @8.0
	@0.0 obj2.shader0.foo = 0 to 10 in @8.0
	
	@0.0 obj2.rot.x = 0 to 180 in @8.0
	@0.0 obj2.rot.y = 0 to -85 in @8.0
	@0.0 obj2.rot.z = 0 to 145 in @8.0

	@0.0 backImg.col.r = 1 to 0 in @1.0
	@1.0 backImg.col.r = eval("fft(3)*0.6") for @7.0
	@0.0 backImg.col.g = eval("fft(4)*1.5") for @8.0
	@0.0 backImg.col.b = eval("fft(5)*2.0") for @8.0
	@8.0 backImg.col.r = 0
	@8.0 backImg.col.g = 0
	@8.0 backImg.col.b = 0

	@7.0 call fuckup

	@8.0 disable cubes, part1, obj2
}

scene_cubes2 {
	@0.0 enable part1, cubes, obj2
	@0.0 cubes.foo = 0 to 10 in @16.0
	@0.0 cam.fovy = 90
	@0.0 loop @1.0 16 times {
		@0.0 ctrl.foo = eval("40 + sin(time) * 25")
	}
	@0.0 ctrl.cam.pos.x = eval(" sin(10000+time*0.0000471)*ctrl('foo')") for @16.0
	@0.0 ctrl.cam.pos.z = eval(" cos(10000+time*0.0000575)*ctrl('foo')") for @16.0
	@0.0 ctrl.cam.pos.y = eval(" cos(10000+ time*0.0000210)*ctrl('foo')") for @16.0
	
	@0.0 cubes.foo2 = eval("cos(time*0.0001)*3") for @16.0
	@0.0 part1.anim = 0 to 10 in @16.0
	@0.0 part1.pointSize = 3.0
	@0.0 part1.yellow = eval("fft(20)^2*10000") for @16.0
	@0.0 obj2.shader0.foo = 0 to 30 in @16.0
	
	@0.0 obj2.rot.x = 0 to 360 in @16.0
	@0.0 obj2.rot.y = 0 to -170 in @16.0
	@0.0 obj2.rot.z = 0 to 290 in @16.0

	@0.0 loop @4.0 4 times {
		@0.0 backImg.col.r = 0.5 to 0 in @4.0
	}
	@0.0 backImg.col.g = eval("fft(4)*0.5") for @16.0
	@0.0 backImg.col.b = eval("fft(5)") for @16.0
	@16.0 backImg.col.r = 0
	@16.0 backImg.col.g = 0
	@16.0 backImg.col.b = 0

	@0.0 loop @4.0 4 times {
		@0.0 enable obj6
		@1.0 enable obj7
		@2.0 enable obj8
		@3.0 enable obj9
		@1.0 disable obj6
		@2.0 disable obj7
		@3.0 disable obj8
		@4.0 disable obj9
	}	
	@0.0 obj6.rot.x = 0 to 180 in @16.0
	@0.0 obj7.rot.y = 0 to 360 in @16.0
	@0.0 obj8.rot.z = 0 to 360 in @16.0
	@0.0 obj9.rot.y = 0 to 360 in @16.0

	@16.0 disable cubes, part1, obj2, obj6, obj7, obj8, obj9
}

scene_wreck {
	@0.0 enable obj4, part1

	@0.0 part1.brightness = 0.0
	@0.0 part1.pointSize = 3.0
	
	@0.0 backImg.frame = 1
	@0.0 backImg.col.r = eval("0.5 * ctrl('foo')+fft(3)") for @16.0
	@0.0 backImg.col.g = eval("0.5 * ctrl('foo')^1.5+fft(4)") for @16.0
	@0.0 backImg.col.b = eval("0.5 * ctrl('foo')^2+fft(5)") for @16.0
	@16.0 backImg.col.r = 0
	@16.0 backImg.col.g = 0
	@16.0 backImg.col.b = 0
	@0.0 ctrl.foo = 0 to 1.0 in @8.0
	
	@0.0 blurImg2.col.a = eval("0.1+(fft(32)+fft(12)+fft(49))*10") for @16.0
	@0.0 loop @2.0 8 times {
		@0.0 blurImg.col.a = 1 to 0 in @1.0
		@1.0 blurImg.col.a = 0 to 1 in @1.0
	}
	@16.0 blurImg2.col.a = 1
	@16.0 blurImg.col.a = 0.5
	
	@0.0 obj4.meshes.mesh1.rot.y = 0 to 40 in @16.0
	@0.0 obj4.meshes.mesh2.rot.y = 0 to 170 in @16.0
	@0.0 obj4.meshes.mesh3.rot.y = 0 to 80 in @16.0
	@0.0 obj4.meshes.mesh4.rot.y = 0 to 20 in @16.0
	@0.0 obj4.meshes.mesh5.rot.y = 0 to -30 in @16.0
	@0.0 obj4.meshes.mesh6.rot.y = 0 to -180 in @16.0
	@0.0 obj4.meshes.mesh7.rot.y = 0 to -70 in @16.0
	@0.0 obj4.meshes.mesh8.rot.y = 0 to -30 in @16.0
	
	@0.0 cam.fovy = 60
	@0.0 loop @1.0 8 times {
		@0.0 ctrl.cam.pos.x = eval(" sin(time*0.2)*8.5")
		@0.0 ctrl.cam.pos.z = eval(" cos(time*0.2)*8.5")
		@0.0 ctrl.cam.pos.y = eval(" cos(time*0.1)*10")
		@0.0 ctrl.cam.lookAt.x = eval(" sin(time*0.2)")
		@0.0 ctrl.cam.lookAt.z = eval(" cos(time*0.3)")
		@0.0 ctrl.cam.lookAt.y = eval(" cos(time*0.4)*5")
	}
	@8.0 loop @2.0 4 times {
		@0.0 ctrl.cam.pos.x = eval(" sin(time*0.2)*8.5")
		@0.0 ctrl.cam.pos.z = eval(" cos(time*0.2)*8.5")
		@0.0 ctrl.cam.pos.y = eval(" cos(time*0.1)*10")
		@0.0 ctrl.cam.lookAt.x = eval(" sin(time*0.2)")
		@0.0 ctrl.cam.lookAt.z = eval(" cos(time*0.3)")
		@0.0 ctrl.cam.lookAt.y = eval(" cos(time*0.4)*5")
	}

	@0.0 enable lines
	@16.0 disable lines
	@0.0 lines.foo = eval("ctrl('foo2')") for @16.0
	@0.0 lines.mix = eval("ctrl('foo2')*0.01") for @16.0
	@0.0 loop @2.0 8 times {
		@0.0 ctrl.foo2 = rand( 0 to 100 )
	}

	@16.0 disable obj4, part1
}

scene_wreck2 {
	@0.0 enable obj4, part2

	@0.0 part2.end = 0 to 1 in @16.0
	@0.0 part2.begin = 0
	@15.0 part2.begin = 0 to 1 in @1.0
	@0.0 part2.anim = 0 to 20 in @16.0
	@0.0 part2.pointSize = 2
	
	@0.0 backImg.frame = 1
	@0.0 backImg.col.r = 0.5 to 0 in @12.0
	@0.0 backImg.col.g = 0.5 to 0 in @10.0
	@0.0 backImg.col.b = 0.5 to 0 in @8.0
	@16.0 backImg.col.r = 0
	@16.0 backImg.col.g = 0
	@16.0 backImg.col.b = 0
	
	@0.0 blurImg2.col.a = 0.5 to 1.0 in @16.0
	@0.0 blurImg.col.a = 0 to 1 in @16.0
	@16.0 blurImg2.col.a = 1.0
	
	@0.0 obj4.meshes.mesh1.rot.y = 0 to 40 in @16.0
	@0.0 obj4.meshes.mesh2.rot.y = 0 to 170 in @16.0
	@0.0 obj4.meshes.mesh3.rot.y = 0 to 80 in @16.0
	@0.0 obj4.meshes.mesh4.rot.y = 0 to 20 in @16.0
	@0.0 obj4.meshes.mesh5.rot.y = 0 to -30 in @16.0
	@0.0 obj4.meshes.mesh6.rot.y = 0 to -180 in @16.0
	@0.0 obj4.meshes.mesh7.rot.y = 0 to -70 in @16.0
	@0.0 obj4.meshes.mesh8.rot.y = 0 to -30 in @16.0
	
	@0.0 cam.fovy = 90 to 170 in @16.0
	@0.0 ctrl.cam.pos.x = eval(" sin(time*0.00005)*10") for @16.0
	@0.0 ctrl.cam.pos.z = eval(" cos(time*0.00005)*10") for @16.0
	@0.0 ctrl.cam.pos.y = 5 to -5 in @16.0
	@0.0 ctrl.cam.lookAt.x = 0
	@0.0 ctrl.cam.lookAt.z = 0
	@0.0 ctrl.cam.lookAt.y = 10 to -0 in @16.0
	
	@12.0 enable faderImg
	@12.0 faderImg.shader0.threshold = -1 to 1 in @4.0
	@12.0 faderImg.zoom = 0 to 0.1 in @4.0
	@16.0 disable faderImg

	@16.0 disable obj4, part2
}

scene_torus {
	@0.0 enable obj5, part3

	@0.0 enable faderImg
	@0.0 faderImg.shader0.threshold = 1 to -1 in @2.0
	@0.0 faderImg.zoom = 0.5 to 0 in @2.0
	@2.0 disable faderImg

	@0.0 backImg.frame = 0
	@0.0 backImg.col.r = 1 to 0 in @4.0
	@0.0 backImg.col.g = 0
	@0.0 backImg.col.b = 0
	@4.0 backImg.col.r = 0 to 0.3 in @12.0
	@8.0 backImg.col.b = 0.0 to 0.4 in @8.0
	@12.0 backImg.col.g = 0.0 to 0.5 in @4.0

	@16.0 backImg.col.r = 0
	@16.0 backImg.col.g = 0
	@16.0 backImg.col.b = 0
	
	@0.0 blurImg2.col.a = eval("0.1+(fft(32)+fft(12)+fft(49))*15") for @16.0
	@0.0 blurImg.col.a = eval("0.85-fft(50)*85*(1+sin(time*time))") for @16.0
	@16.0 blurImg2.col.a = 1.0
	@16.0 blurImg.col.a = 0.5
		
	@0.0 cam.fovy = spline( 90, 90, 120, 200 ) in @16.0
	@0.0 ctrl.cam.pos.x = eval(" sin(time*0.0001)*7") for @16.0
	@0.0 ctrl.cam.pos.z = eval(" cos(time*0.0001)*7") for @16.0
	@0.0 ctrl.cam.pos.y = 0
	@0.0 ctrl.cam.lookAt.x = eval(" sin(time*0.0001+ctrl('foo'))*7") for @16.0
	@0.0 ctrl.cam.lookAt.z = eval(" cos(time*0.0001+ctrl('foo'))*7") for @16.0
	@0.0 ctrl.cam.lookAt.y = eval(" sin(time*0.0007)") for @16.0
	@0.0 ctrl.foo = -0.1 to -9 in @16.0
	@0.0 cam.up.y = 1
	
	@0.0 part3.anim = 0 to 2 in @16.0
	@0.0 call fuckup3
	
	@16.0 disable obj5, part3
}

scene_torus2 {
	@0.0 enable obj5, part3

	@0.0 backImg.frame = 0
	@0.0 backImg.col.r = 0.3 to 0 in @8.0
	@0.0 backImg.col.g = 0.4 to 0 in @8.0
	@0.0 backImg.col.b = 0.5 to 0 in @8.0

	@16.0 backImg.col.r = 0
	@16.0 backImg.col.g = 0
	@16.0 backImg.col.b = 0
	
	@0.0 blurImg2.col.a = eval("0.1+(fft(32)+fft(12)+fft(49))*15") for @16.0
	@0.0 blurImg.col.a = eval("0.85-fft(50)*85*(1+sin(time*time))") for @16.0
	@16.0 blurImg2.col.a = 1.0
	@16.0 blurImg.col.a = 0.5
		
	@0.0 cam.fovy = spline( 90, 120, 170, 170 ) in @16.0
	@0.0 ctrl.cam.pos.x = eval(" sin(time*0.0001)*7") for @16.0
	@0.0 ctrl.cam.pos.z = eval(" cos(time*0.0001)*7") for @16.0
	@0.0 ctrl.cam.pos.y = 0
	@0.0 ctrl.cam.lookAt.x = eval(" sin(time*0.0001+ctrl('foo'))*7") for @16.0
	@0.0 ctrl.cam.lookAt.z = eval(" cos(time*0.0001+ctrl('foo'))*7") for @16.0
	@0.0 ctrl.cam.lookAt.y = eval(" sin(time*0.0007)") for @16.0
	@0.0 ctrl.foo = -9 to -12 in @16.0
	@0.0 cam.up.y = 1
	
	@0.0 part3.anim = 2 to 4 in @16.0

	@0.0 enable faderImg
	@0.0 faderImg.frame = 1
	@0.0 faderImg.shader0.threshold = -1 to 1 in @16.0
	@0.0 faderImg.zoom = 0.2 to 0 in @16.0

	@16.0 disable obj5, part3
}

scene_city {
	@0.0 enable part4, obj2

	@0.0 enable faderImg
	@0.0 faderImg.shader0.threshold = 1 to -1 in @2.0
	@0.0 faderImg.zoom = 0 to 0.1 in @2.0
	@2.0 disable faderImg
	
	@0.0 backImg.frame = 0
	@0.0 backImg.col.b = 0 to 0.2 in @8.0
	@0.0 backImg.col.g = 0 to 0.1 in @8.0
	@0.0 backImg.col.r = 0
	@8.0 backImg.col.b = 0.2 to 0 in @8.0
	@8.0 backImg.col.g = 0.1 to 0 in @8.0
	
	@0.0 blurImg.col.a = 1.0 to 0.5 in @16.0
	@16.0 blurImg.col.a = 0.5

	@0.0 ctrl.cam.lookAt.x = eval("sin(time*0.0003)*5") for @16.0
	@0.0 ctrl.cam.lookAt.z = eval("cos(time*0.0002)*5") for @16.0
	@0.0 ctrl.cam.lookAt.y = 0 to 12 in @16.0
	
	@0.0 ctrl.cam.pos.x = eval("cos(time*0.0002)*ctrl('foo')") for @16.0
	@0.0 ctrl.cam.pos.z = eval("sin(time*0.0003)*ctrl('foo')") for @16.0
	@0.0 ctrl.cam.pos.y = 1 to 10 in @16.0
	@0.0 ctrl.foo = 10 to 30 in @16.0

	@0.0 cam.up.y = 1
	@0.0 cam.up.x = 0
	@0.0 cam.up.z = 0
	@0.0 cam.fovy = 45
	
	@0.0 part4.blowy = 20 to 0 in @16.0
	@0.0 part4.br = eval("0.2 + ((fft(10)+fft(40)+fft(90))*0.3333)^2*10000") for @16.0

	#@15.0 enable faderImg
	#@15.0 faderImg.shader0.threshold = -1 to 1 in @1.0
	#@15.0 faderImg.zoom = 0 to 0.1 in @1.0
	#@16.0 disable faderImg

	@15.0 call fuckup
	
	@16.0 disable part4, obj2
}

commonStuff: %SPEED% {
	@0.0 call obj1WithParticles( %SPEED% )
	@0.0 call cameraRun
	@0.0 loop @2.0 8 times {
		@0.0 cam.fovy = eval(" 90+sin(time*0.051)*30")
		@0.0 ctrl.cam.pos.x = eval(" sin(time*0.051)*15")
		@0.0 ctrl.cam.pos.z = eval(" cos(time*0.075)*15")
		@0.0 ctrl.cam.pos.y = eval(" cos(time*0.010)*15")
	}
	@0.0 part1.yellow = eval("fft(20)^2*10000") for @16.0
}

bgPump {
	@0.0 backImg.col.r = eval("fft(3)*0.3") for @16.0
	@0.0 backImg.col.g = eval("fft(4)*0.75") for @16.0
	@0.0 backImg.col.b = eval("fft(5)") for @16.0
	@16.0 backImg.col.r = 0
	@16.0 backImg.col.g = 0
	@16.0 backImg.col.b = 0
}

obj1WithParticles: %SPEED% {
	@0.0 enable obj1
	@0.0 obj1.shader0.foo = 0.0 to %SPEED% in @16.0
	@0.0 part1.anim = 0 to %SPEED% in @16.0
	@0.0 part2.anim = 0 to %SPEED% in @16.0
	@16.0 disable obj1
}

cameraRun {
	@0.0 ctrl.cam.lookAt.x = eval("sin(time*0.0001)*10") for @16.0
	@0.0 ctrl.cam.lookAt.y = eval("sin(time*0.0002)*10") for @16.0
	@0.0 ctrl.cam.lookAt.z = eval("sin(time*0.0003)*10") for @16.0
	@0.0 cam.up.x = eval("sin(time*0.00021)") for @16.0
	@0.0 cam.up.y = eval("sin(time*0.00032)") for @16.0
	@0.0 cam.up.z = eval("sin(time*0.00043)") for @16.0
}

texts {
	@0.0 enable textImg
	@0.0 call textTimings
	@16.0 disable textImg
	
	@0.0 textImg.zoom = eval("fft(64)^2*1000") for @16.0
	@0.0 textImg.col.b = eval("fft(32)^2*30000") for @16.0
	@0.0 textImg.col.g = eval("0.2+fft(33)^2*30000") for @16.0
	@0.0 textImg.col.r = eval("0.3+fft(34)^2*30000") for @16.0
	@0.0 textImg.zoom.x = eval("fft(96)^2*2500") for @16.0
	@0.0 textImg.offset.x = eval("fft(10)") for @16.0
	@0.0 textImg.rotate = eval("fft(120)*640") for @16.0
}

textTimings {
	0.18 call setText 0
	2.00 textImg.offset.y = spline(0,0,-2,-40) in 0.56
	2.56 call setText 1
	3.84 call setText 2
	5.50 textImg.offset.y = spline(0,0,-2,100) in 0.74
	6.24 call setText 3
	7.56 call setText 4
	8.28 call setText 5
	9.28 call setText 6
	10.56 call setText 7
	11.76 call setText 8
	13.50 textImg.offset.y = spline(0,0,-2,-80) in 1.02
	14.52 call setText 9
	16.08 call setText 10
	17.88 call setText 11
	18.84 call setText 12
	20.00 textImg.offset.y = spline(0,0,-2,-40) in 0.88
	20.88 call setText 13
	22.00 textImg.offset.y = spline(0,0,2,-40) in 0.32
	22.32 call setText 14
	23.76 call setText 15
	25.50 textImg.offset.y = spline(0,0,2,80) in 0.9
	26.40 call setText 16
	28.80 call setText 17
}

setText: %INDEX% {
	@0.0 textImg.frame = %INDEX%
	@0.0 textImg.zoom.y = rand( 0 to 30 ) for 0.2
	0.2 textImg.zoom.y = 0
	@0.0 textImg.col.a = 0 to 1 in 0.2
}

fuckup {
	@0.0 outputImg.shader0.fuckupAmount = eval("fft(50)^2*100000") for @1.0
	@0.0 outputImg.shader0.fuckupFoo = rand( 0 to 1 ) for @1.0
	@1.0 outputImg.shader0.fuckupAmount = 0
}

fuckup2 {
	@0.0 outputImg.shader0.fuckupAmount = 0 to 1 in @1.0
	@0.0 outputImg.shader0.fuckupFoo = rand( 0 to 1 ) for @1.0
	@1.0 outputImg.shader0.fuckupAmount = 0
}

fuckup3 {
	@0.0 outputImg.shader0.fuckupAmount = eval("fft(50)^3*250") for @16.0
	@0.0 outputImg.shader0.fuckupFoo = rand( 0 to 1 ) for @16.0
	@16.0 outputImg.shader0.fuckupAmount = 0
}