function LightningAnim09 (Begin, LiveTime, timeScene)
	local LocalTime = (timeScene - Begin)/LiveTime	
	local flash = 0.1
--	currentMult.Scene4_light.Lightning.scale = 0.8
	if Begin <= timeScene and  timeScene < Begin + LiveTime then
		currentMult.Scene9_light.layer.isVisible = true
		if LocalTime <= flash then
			local FlashTime = LocalTime/flash		
			currentMult.Scene9_light.Lightning.color = Color(240, 240, 255, lerp (0, 255, FlashTime))
			currentMult.Scene9.Light.color = Color(255, 255, 255, lerp (0, 150, FlashTime))
			currentMult.Scene9_light.Lightning.color = Color(240, 240, 255, lerp (0, 255, FlashTime))						
		else
			local SlowTime  = ease((LocalTime-flash)/(1 -flash), 0.1, 0) 		
			currentMult.Scene9_light.Lightning.color = Color(240, 240, 255, lerp (150, 0, SlowTime ))
			currentMult.Scene9.Light.color = Color(255, 255, 255, lerp (150, 0, SlowTime ))
		end	
		currentMult.Scene9_light.Lightning.x     = 350
		currentMult.Scene9_light.Lightning.y     = lerp(230, 235, timeScene)
	else
		currentMult.Scene9_light.Lightning.color = Color(255, 255, 255, 0)
		currentMult.Scene9_light.layer.isVisible = false
	end	
end

function Effects09A ( timeScene )	
	currentMult.Effect09A.Altar.x = 250
	currentMult.Effect09A.Altar.y = lerp (120, 140, timeScene)
end



function Effects09(timeScene)		
	                  
	currentMult.Effect09.Spark1.x = 230
	currentMult.Effect09.Spark1.y = 170
                      
	currentMult.Effect09.Spark2.x = 210
	currentMult.Effect09.Spark2.y = 161
	                  
	currentMult.Effect09.Spark3.x = 210
	currentMult.Effect09.Spark3.y = 131
                      
	currentMult.Effect09.Spark4.x = 230
	currentMult.Effect09.Spark4.y = 119
	                  
	currentMult.Effect09.Spark5.x = 282
	currentMult.Effect09.Spark5.y = 119
                      
	currentMult.Effect09.Spark6.x = 300
	currentMult.Effect09.Spark6.y = 131
	                  
	currentMult.Effect09.Spark7.x = 300
	currentMult.Effect09.Spark7.y = 161
	                
	currentMult.Effect09.Spark8.x = 282
	currentMult.Effect09.Spark8.y = 170
	                  
	currentMult.Effect09.Glow.x = 255
	currentMult.Effect09.Glow.y = 173	                
	 
	currentMult.Effect09.layer.y = lerp(-51, -58, timeScene)
	currentMult.Effect09.layer.x = lerp(85, -59, timeScene)
	currentMult.Effect09.layer.scale = lerp(0.605, 1.21, timeScene)	
	
	local MegaX = lerp (400, 400, timeScene)
	local MegaY = 430
	
	currentMult.Effect09R.RainRight.x = MegaX
	currentMult.Effect09R.RainRight.y = MegaY --lerp (MegaY+100, MegaY + 100, timeScene) 
	                    
	currentMult.Effect09R.BackgroundRain.x = 350 --MegaX
	currentMult.Effect09R.BackgroundRain.y = MegaY - 100 
	                   
end        

local DoAnim9 = false

function Visual_9 (timeScene, Relax, Destroid, Pause)
--	if timeScene <= 1 - Destroid - Pause then   					
--		local T = ease(timeScene/(1 - Destroid - Pause), 0, Relax)
	if timeScene <= 1 - Pause then   				
		local T = ease(timeScene/(1 - Pause), 0, Relax)	

		local T = ease(timeScene/1, 0, Relax)	
		
		currentMult.Scene9.Earth.y            = lerp(70, 72, T) 
		currentMult.Scene9.Earth.scale        = lerp(1, 1.05, T)		
									 
		currentMult.Scene9.Island6.x          = lerp(100 , 90  , T)
		currentMult.Scene9.Island6.y          = lerp(130 , 130, T)	
		currentMult.Scene9.Island6s.x         = lerp(102 , 92  , T)
		currentMult.Scene9.Island6s.y         = lerp(128 , 128, T)	
		
									   
		currentMult.Scene9.Island5.x          = lerp(400, 430, T)
		currentMult.Scene9.Island5.y          = lerp(30  , 50, T)	
		currentMult.Scene9.Island5s.x         = lerp(398, 428, T)
		currentMult.Scene9.Island5s.y         = lerp(36  ,  56, T)	
									           
		currentMult.Scene9.Island4.x          = lerp(60, 30, T)
		currentMult.Scene9.Island4.y          = lerp(40, 40, T)
		currentMult.Scene9.Island4.scale      = lerp(1 , 1.1, T)	
		currentMult.Scene9.Island4s.x         = lerp(62, 32, T)
		currentMult.Scene9.Island4s.y         = lerp(45, 45, T)
		currentMult.Scene9.Island4s.scale     = lerp(1 , 1.1, T)
									            
		currentMult.Scene9.Island3.x          = lerp(80, 10, T)
		currentMult.Scene9.Island3.y          = lerp(10, 0, T)
		currentMult.Scene9.Island3.scale      = lerp(1 , 1.2, T)			
									   
		currentMult.Scene9.Island2.x          = lerp(420, 500, T)
		currentMult.Scene9.Island2.y          = lerp(250, 300, T)	
		currentMult.Scene9.Island2s.x         = lerp(460, 540, T)
		currentMult.Scene9.Island2s.y         = lerp(214, 264, T)	
									           
		currentMult.Scene9.Cloud5.x           = lerp(400, 600, T)
		currentMult.Scene9.Cloud5.y           = lerp(140, 180, T)			
									  
		currentMult.Scene9.Island1.x          = lerp(400, 800, T)
		currentMult.Scene9.Island1.y          = lerp(130, 250, T)
		currentMult.Scene9.Island1.scale      = lerp(1, 2.5, T)	
		currentMult.Scene9.Island1s.x         = lerp(398, 798, T)
		currentMult.Scene9.Island1s.y         = lerp(130, 250, T)
		currentMult.Scene9.Island1s.scale     = lerp(1, 2.5, T)	
											    
		currentMult.Scene9.Altar.x            = lerp(230, 230, T)
		currentMult.Scene9.Altar.y            = lerp(-20, 0, T)
		currentMult.Scene9.Altar.scale        = lerp(0.5, 1, T)
		
		currentMult.Scene9.AltarShadow.x      = lerp(237, 247, T)
		currentMult.Scene9.AltarShadow.y      = lerp(-13, 11, T)
		currentMult.Scene9.AltarShadow.scale  = lerp(0.5, 1, T)	
										        
		currentMult.Scene9.Cloud4.x           = lerp(380, 580, T)
		currentMult.Scene9.Cloud4.y           = lerp(10, -50, T)	
									   
		currentMult.Scene9.Cloud3.x           = lerp(50, -50, T)
		currentMult.Scene9.Cloud3.y           = 20	
									   
		currentMult.Scene9.Cloud2.x           = lerp(100, -550, T)
		currentMult.Scene9.Cloud2.y           = lerp(100, 80, T)
		currentMult.Scene9.Cloud2.scale       = lerp(1, 2, T)	
									   
		currentMult.Scene9.Cloud1.x           = lerp(300, 250, T)
		currentMult.Scene9.Cloud1.y           = lerp(30, -400, T)
		currentMult.Scene9.Cloud1.scale       = lerp(1, 2.5, T)	
		
		currentMult.Scene9.Symbol.x = 245
		currentMult.Scene9.Symbol.y = lerp(80, 200, T)
		currentMult.Scene9.Symbol.scale = lerp(0.9, 1.4, T)	
		
		currentMult.Scene9.SkyShadow.color    = Color (255, 255, 255, 0)
		currentMult.Scene9.StormCloud.color   = Color (255, 255, 255, 0)
	
		currentMult.Scene9.ArcShadow.color    = Color (255, 255, 255, 0)
		currentMult.Scene9.Star.color         = Color (255, 255, 255, 255)
		currentMult.Scene9.AltarShadow.color  = Color (255, 255, 255, 0)
		currentMult.Scene9.Symbol.color = Color (255, 255, 255, 255)
		
		currentMult.Scene9.Island1s.color     = Color(255, 255, 255, 0)		
		currentMult.Scene9.Island2s.color     = Color(255, 255, 255, 0)				
		currentMult.Scene9.Island4s.color     = Color(255, 255, 255, 0)		
		currentMult.Scene9.Island5s.color     = Color(255, 255, 255, 0)
		currentMult.Scene9.Island6s.color     = Color(255, 255, 255, 0)
		                                                             
		Effects09(T)		
		if not DoAnim9 and timeScene >= 0.3 then
			DoAnim9 = true
			currentMult.Effect09A.layer.isVisible = true
			currentMult.Effect09A.Altar:Do("Reset")				
		elseif timeScene < 0.3 then
			DoAnim9 = false
		end
		
		Effects09A ( timeScene )	
		
--	elseif  1 - Destroid <= timeScene + Pause and  timeScene + Pause < 1 then
--		local T = (timeScene + Pause - 1)/Destroid + 1
		currentMult.Scene9.Rainbow.color      = Color(255, 255, 255, 255)					
		if  1 - Destroid <= timeScene + Pause and  timeScene + Pause < 1 then
			local Ts = ease((timeScene + Pause - 1)/Destroid + 1, 0, 0.8)
			
			currentMult.Effect09R.layer.isVisible = true		
			currentMult.Effect09R.RainRight.color      = Color(255, 255, 255, lerp(0, 255, Ts))
			currentMult.Effect09R.BackgroundRain.color = Color(255, 255, 255, lerp(0, 255, Ts))
			
			currentMult.Scene9.SkyShadow.color    = Color(255, 255, 255, lerp(0, 255, Ts))
			--currentMult.Scene9.StormCloud.color   = Color(255, 255, 255, lerp(0, 255, Ts))		
			currentMult.Scene9.ArcShadow.color    = Color(255, 255, 255, lerp(0, 255, Ts))
			currentMult.Scene9.Star.color         = Color(255, 255, 255, lerp(255, 0, Ts))
			currentMult.Scene9.AltarShadow.color  = Color(255, 255, 255, lerp(0, 255, Ts))		
			
			currentMult.Scene9.Island1s.color     = Color(255, 255, 255, lerp(0, 255, Ts))		
			currentMult.Scene9.Island2s.color     = Color(255, 255, 255, lerp(0, 255, Ts))		
			currentMult.Scene9.Island4s.color     = Color(255, 255, 255, lerp(0, 255, Ts))		
			currentMult.Scene9.Island5s.color     = Color(255, 255, 255, lerp(0, 255, Ts))		
			currentMult.Scene9.Island6s.color     = Color(255, 255, 255, lerp(0, 255, Ts))					
			
			currentMult.Scene9.Rainbow.color      = Color(255, 255, 255, lerp(255, 0, Ts))					
			
			currentMult.Scene9.Symbol.x = 245
			currentMult.Scene9.Symbol.y = lerp(80, 200, T)
			currentMult.Scene9.Symbol.scale = lerp(1.5-0.5*(Destroid+Pause), 0, Ts)						
			currentMult.Scene9.Symbol.color = Color(255, 255, 255,  lerp(255, 0, ease(Ts,0,0.8) ))						
		--	LightningAnim09 (0.8, 0.3, Ts )
			currentMult.Effect09.Spark1.color = Color (255,255,255, lerp (255,0, Ts))
			currentMult.Effect09.Spark2.color = Color (255,255,255, lerp (255,0, Ts))
			currentMult.Effect09.Spark3.color = Color (255,255,255, lerp (255,0, Ts))  
			currentMult.Effect09.Spark4.color = Color (255,255,255, lerp (255,0, Ts))
			currentMult.Effect09.Spark5.color = Color (255,255,255, lerp (255,0, Ts))  
			currentMult.Effect09.Spark6.color = Color (255,255,255, lerp (255,0, Ts))  
			currentMult.Effect09.Spark7.color = Color (255,255,255, lerp (255,0, Ts))  
			currentMult.Effect09.Spark8.color = Color (255,255,255, lerp (255,0, Ts))
			currentMult.Effect09.Glow.color = Color (255,255,255, lerp (255,0, Ts))
		else
			currentMult.Scene9.Symbol.scale = lerp(0.9, 1.4, T)				
		end
	end
	
	currentMult.Scene9.Sky.x              = 250											   
	currentMult.Scene9.Sky.y              = 167								
	
	currentMult.Scene9.SkyShadow.x        = 250
	currentMult.Scene9.SkyShadow.y        = 170		
									                          
	currentMult.Scene9.StormCloud.x       = 250
	currentMult.Scene9.StormCloud.y       = 170		
	
	currentMult.Scene9.Rainbow.x          = 200
	currentMult.Scene9.Rainbow.y          = 190	
								   
	currentMult.Scene9.Arc.x              = 180
	currentMult.Scene9.Arc.y              = 130	
							   
	currentMult.Scene9.ArcShadow.x        = 190
	currentMult.Scene9.ArcShadow.y        = 175		
									 
	currentMult.Scene9.Star.x             = 113
	currentMult.Scene9.Star.y             = 275		
								
	currentMult.Scene9.Earth.x            = 230	
end
                    
function SymbolAnim_4 (timeScene)
	
end

function Scene9Hide()
	currentMult.Scene9.layer.isVisible = false
	currentMult.Effect09.Spark1:Do ("Finish")
	currentMult.Effect09.Spark2:Do ("Finish")
	currentMult.Effect09.Spark3:Do ("Finish")
	currentMult.Effect09.Spark4:Do ("Finish")
	currentMult.Effect09.Spark5:Do ("Finish")
	currentMult.Effect09.Spark6:Do ("Finish")
	currentMult.Effect09.Spark7:Do ("Finish")
	currentMult.Effect09.Spark8:Do ("Finish")
	currentMult.Effect09.Glow:Do   ("Finish")

	
	currentMult.Effect09A.Altar:Do          ("Finish")	
	currentMult.Effect09R.RainRight:Do      ("Finish")	
	currentMult.Effect09R.BackgroundRain:Do ("Finish")		
end 

function Scene9Show()
	currentMult.Effect09.Spark1:Do ("Reset")
	currentMult.Effect09.Spark2:Do ("Reset")
	currentMult.Effect09.Spark3:Do ("Reset")
	currentMult.Effect09.Spark4:Do ("Reset")
	currentMult.Effect09.Spark5:Do ("Reset")
	currentMult.Effect09.Spark6:Do ("Reset")
	currentMult.Effect09.Spark7:Do ("Reset")
	currentMult.Effect09.Spark8:Do ("Reset")
	currentMult.Effect09.Glow:Do   ("Reset")
	
	currentMult.Effect09A.Altar:Do          ("Reset")	
	currentMult.Effect09R.RainRight:Do      ("Reset")	
	currentMult.Effect09R.BackgroundRain:Do ("Reset")		

	currentMult.Scene9.layer.isVisible = true
	
end 