local createCompositionbutterfly = nil
local createCompositionfront = nil
local createCompositiongrass = nil
local createCompositionsky = nil
---------------------------------------------------------------------------------------
local PREFIX_PATH = "data/Texture/Scenes/06_garden/main/anim/z_gate/"
---------------------------------------------------------------------------------------
function Loader_06_Zoom_Gate_Animations(parent)
	return CreateAnimationLoadingRoutine(parent, PREFIX_PATH,
		{
    	    CreateCompositionLoader(createCompositionfront,	'front', 0,0, 30, 320,240, true),
    	    CreateCompositionLoader(createCompositionsky,	'sky',   0,0, 1,  320,240, true),
		},
		{
			function (element, textureName)
				if textureName == "bird__[]_.png" then
					local anim = element:GetTexture()
					anim:SetFrames(23)
					anim:SetTextureRect(0,0,22,24)
					anim:SetSpeed(23)
					anim:SetMode(HGEANIM_FWD + HGEANIM_LOOP)
					anim:SetBlendMode(0)
					anim:Play()
				end
				if textureName == "butterfly_mov_[].png" then
					local anim = element:GetTexture()
					anim:SetFrames(93)
					anim:SetTextureRect(0,0,200,140)
					anim:SetSpeed(30)
					anim:SetMode(HGEANIM_FWD + HGEANIM_NOLOOP)
					anim:Play()
				end
			end,
		});
end
---------------------------------------------------------------------------------------
createCompositionbutterfly = function()
	local compositionbutterfly = CreateCompositionSequence()
	local compositionDuration = 3.1
	compositionbutterfly:SetDuration(compositionDuration)
 
	local element
	local effector
 
	-- Layer Layer_1
	element = CreateCompositionElement(PREFIX_PATH.."butterfly_mov_[].png")
	element:SetName("Layer_1")
	compositionbutterfly:AddElement(element)
	element:SetHotSpot(100, 70)
	element:SetParentElement(compositionbutterfly)
	element:SetXY(100, 70)
 
 
	effector = element:GetEffector()
	effector:SetLifeTime(0, 3.1)
	effector:Play()
 
	compositionbutterfly:Play()
 
	return compositionbutterfly
end
 
createCompositionfront = function()
	local compositionfront = CreateCompositionSequence()
	local compositionDuration = 7
	compositionfront:SetDuration(compositionDuration)
 
	local element
	local effector
 
	-- Layer Layer_1
	element = createCompositiongrass()
	element:SetName("Layer_1")
	compositionfront:AddElement(element)
	element:SetHotSpot(320, 240)
	element:SetParentElement(compositionfront)
	element:SetXY(320, 240)
 
 
	effector = element:GetEffector()
	effector:SetLifeTime(0, 7)
	effector:Play()
 
 
	-- Layer Layer_2
	element = createCompositionbutterfly()
	element:SetName("Layer_2")
	compositionfront:AddElement(element)
	element:SetHotSpot(100, 70)
	element:SetParentElement(compositionfront)
	element:SetScaleX(0.71)
	element:SetScaleY(0.71)
 
	effector = element:GetEffector()
	effector:SetLifeTime(0, 3.1)
	effector:SetKey(_TRACK_X, 1.875, 41)
	effector:SetKey(_TRACK_Y, 1.875, 374)
	effector:SetKey(_TRACK_X, 3.04166666666667, 3)
	effector:SetKey(_TRACK_Y, 3.04166666666667, 374)
	effector:Play()
 
	compositionfront:Play()
 
	return compositionfront
end
 
createCompositiongrass = function()
	local compositiongrass = CreateCompositionSequence()
	local compositionDuration = 7
	compositiongrass:SetDuration(compositionDuration)
 
	local element
	local effector
 
	-- Layer Layer_1
	element = CreateCompositionElement(PREFIX_PATH.."grass3.png")
	element:SetName("Layer_1")
	compositiongrass:AddElement(element)
	element:SetHotSpot(37.5, 55.5)
	element:SetParentElement(compositiongrass)
	element:SetXY(67.5, 417.5)
 
	element:SetScaleX(1.35)
	element:SetScaleY(1.35)
 
	effector = element:GetEffector()
	effector:SetLifeTime(0, 7)
	effector:SetKey(_TRACK_A, 0, 0)
	effector:SetKey(_TRACK_A, 0.33333333333333, -0.01387330079755)
	effector:SetKey(_TRACK_A, 0.66666666666667, -0.0471951210995)
	effector:SetKey(_TRACK_A, 1, -0.0875184378275)
	effector:SetKey(_TRACK_A, 1.33333333333333, -0.12239614986962)
	effector:SetKey(_TRACK_A, 1.66666666666667, -0.13938122021397)
	effector:SetKey(_TRACK_A, 1.70833333333333, -0.13962635014516)
	effector:SetKey(_TRACK_A, 2, -0.12540512522722)
	effector:SetKey(_TRACK_A, 2.33333333333333, -0.08365366683368)
	effector:SetKey(_TRACK_A, 2.66666666666667, -0.02996139753526)
	effector:SetKey(_TRACK_A, 3, 0.01975061419478)
	effector:SetKey(_TRACK_A, 3.33333333333333, 0.04956125754689)
	effector:SetKey(_TRACK_A, 3.45833333333333, 0.05235988776719)
	effector:SetKey(_TRACK_A, 3.66666666666667, 0.04648226486431)
	effector:SetKey(_TRACK_A, 4, 0.01796937428869)
	effector:SetKey(_TRACK_A, 4.33333333333333, -0.0234406850658)
	effector:SetKey(_TRACK_A, 4.66666666666667, -0.06560939086487)
	effector:SetKey(_TRACK_A, 5, -0.09639823127965)
	effector:SetKey(_TRACK_A, 5.25, -0.10471976291503)
	effector:SetKey(_TRACK_A, 5.33333333333333, -0.1039965233055)
	effector:SetKey(_TRACK_A, 5.66666666666667, -0.08906976068177)
	effector:SetKey(_TRACK_A, 6, -0.06189042447506)
	effector:SetKey(_TRACK_A, 6.33333333333333, -0.03179382030616)
	effector:SetKey(_TRACK_A, 6.66666666666667, -0.00811520962321)
	effector:SetKey(_TRACK_A, 6.95833333333333, 0)
	effector:Play()
 
 
	-- Layer Layer_2
	element = CreateCompositionElement(PREFIX_PATH.."grass2.png")
	element:SetName("Layer_2")
	compositiongrass:AddElement(element)
	element:SetHotSpot(37, 64)
	element:SetParentElement(compositiongrass)
	element:SetXY(623.5, 388)
 
	element:SetScaleX(1.37)
	element:SetScaleY(1.37)
 
	effector = element:GetEffector()
	effector:SetLifeTime(0, 7)
	effector:SetKey(_TRACK_A, 0, 0)
	effector:SetKey(_TRACK_A, 0.33333333333333, -0.02071374933371)
	effector:SetKey(_TRACK_A, 0.66666666666667, -0.07377501771905)
	effector:SetKey(_TRACK_A, 1, -0.14556380940034)
	effector:SetKey(_TRACK_A, 1.33333333333333, -0.22246010733849)
	effector:SetKey(_TRACK_A, 1.66666666666667, -0.29084386652457)
	effector:SetKey(_TRACK_A, 2, -0.33709514307349)
	effector:SetKey(_TRACK_A, 2.25, -0.34906584583422)
	effector:SetKey(_TRACK_A, 2.33333333333333, -0.34725773897023)
	effector:SetKey(_TRACK_A, 2.66666666666667, -0.30994084724462)
	effector:SetKey(_TRACK_A, 3, -0.24199253336935)
	effector:SetKey(_TRACK_A, 3.33333333333333, -0.1667509767883)
	effector:SetKey(_TRACK_A, 3.66666666666667, -0.10755448997577)
	effector:SetKey(_TRACK_A, 3.95833333333333, -0.08726646908835)
	effector:SetKey(_TRACK_A, 4, -0.08738839934059)
	effector:SetKey(_TRACK_A, 4.33333333333333, -0.09598092528689)
	effector:SetKey(_TRACK_A, 4.66666666666667, -0.11421313541779)
	effector:SetKey(_TRACK_A, 5, -0.13657664482002)
	effector:SetKey(_TRACK_A, 5.33333333333333, -0.15756306717368)
	effector:SetKey(_TRACK_A, 5.66666666666667, -0.17166395852295)
	effector:SetKey(_TRACK_A, 5.875, -0.17453290962237)
	effector:SetKey(_TRACK_A, 6, -0.16809814826446)
	effector:SetKey(_TRACK_A, 6.33333333333333, -0.10724599963552)
	effector:SetKey(_TRACK_A, 6.66666666666667, -0.03114106791908)
	effector:SetKey(_TRACK_A, 6.95833333333333, 0)
	effector:Play()
 
 
	-- Layer Layer_3
	element = CreateCompositionElement(PREFIX_PATH.."grass1.png")
	element:SetName("Layer_3")
	compositiongrass:AddElement(element)
	element:SetHotSpot(44, 27.5)
	element:SetParentElement(compositiongrass)
	element:SetXY(534.5, 420.5)
 
	element:SetScaleX(1.36)
	element:SetScaleY(1.36)
 
	effector = element:GetEffector()
	effector:SetLifeTime(0, 7)
	effector:SetKey(_TRACK_A, 0, 0)
	effector:SetKey(_TRACK_A, 0.33333333333333, 0.04508821478357)
	effector:SetKey(_TRACK_A, 0.66666666666667, 0.15338416737223)
	effector:SetKey(_TRACK_A, 1, 0.28443491374039)
	effector:SetKey(_TRACK_A, 1.33333333333333, 0.39778747326908)
	effector:SetKey(_TRACK_A, 1.66666666666667, 0.45298893152267)
	effector:SetKey(_TRACK_A, 1.70833333333333, 0.4537856102217)
	effector:SetKey(_TRACK_A, 2, 0.42966311408724)
	effector:SetKey(_TRACK_A, 2.33333333333333, 0.36187300140216)
	effector:SetKey(_TRACK_A, 2.66666666666667, 0.2820164346165)
	effector:SetKey(_TRACK_A, 3, 0.22227059657379)
	effector:SetKey(_TRACK_A, 3.20833333333333, 0.2094394989684)
	effector:SetKey(_TRACK_A, 3.33333333333333, 0.21365983834091)
	effector:SetKey(_TRACK_A, 3.66666666666667, 0.25672290792657)
	effector:SetKey(_TRACK_A, 4, 0.32229443534632)
	effector:SetKey(_TRACK_A, 4.33333333333333, 0.38036312222683)
	effector:SetKey(_TRACK_A, 4.625, 0.40142571688883)
	effector:SetKey(_TRACK_A, 4.66666666666667, 0.40104626951476)
	effector:SetKey(_TRACK_A, 5, 0.37365306064215)
	effector:SetKey(_TRACK_A, 5.33333333333333, 0.31290524719792)
	effector:SetKey(_TRACK_A, 5.66666666666667, 0.23284687087979)
	effector:SetKey(_TRACK_A, 6, 0.14752194795471)
	effector:SetKey(_TRACK_A, 6.33333333333333, 0.07097457306731)
	effector:SetKey(_TRACK_A, 6.66666666666667, 0.01724875217711)
	effector:SetKey(_TRACK_A, 6.95833333333333, 0)
	effector:Play()
 
	compositiongrass:Play()
 
	return compositiongrass
end
 
createCompositionsky = function()
	local compositionsky = CreateCompositionSequence()
	local compositionDuration = 7
	compositionsky:SetDuration(compositionDuration)
 
	local element
	local effector
 
	-- Layer Layer_1
	element = CreateCompositionElement(PREFIX_PATH.."vorota__2_.png")
	element:SetName("Layer_1")
	compositionsky:AddElement(element)
	element:SetHotSpot(320, 123.5)
	element:SetParentElement(compositionsky)
	element:SetXY(320, 123.5)
 
 
	effector = element:GetEffector()
	effector:SetLifeTime(0, 7)
	effector:Play()
 
 
	-- Layer Layer_2
	element = CreateCompositionElement(PREFIX_PATH.."dom.png")
	element:SetName("Layer_2")
	compositionsky:AddElement(element)
	element:SetHotSpot(99.5, 105)
	element:SetParentElement(compositionsky)
	element:SetXY(345.5, 242)
 
 
	effector = element:GetEffector()
	effector:SetLifeTime(0, 7)
	effector:Play()
 
 
	-- Layer Layer_3
	element = CreateCompositionElement(PREFIX_PATH.."bird__[]_.png")
	element:SetName("Layer_3")
	compositionsky:AddElement(element)
	element:SetHotSpot(-205, -40)
	element:SetParentElement(compositionsky)
	element:SetOpacity(0.45)
 
	effector = element:GetEffector()
	effector:SetLifeTime(0, 7)
	effector:SetKey(_TRACK_X, 0, -50.5)
	effector:SetKey(_TRACK_Y, 0, 84.5)
	effector:SetKey(_TRACK_X, 0.875, -5.58703818242793)
	effector:SetKey(_TRACK_Y, 0.875, 84.5)
	effector:SetKey(_TRACK_X, 2.20833333333333, 88.460176584656)
	effector:SetKey(_TRACK_Y, 2.20833333333333, 65.2243141019356)
	effector:SetKey(_TRACK_X, 5.70833333333333, 274.5)
	effector:SetKey(_TRACK_Y, 5.70833333333333, 94.5)
	effector:Play()
 
 
	-- Layer Layer_4
	element = CreateCompositionElement(PREFIX_PATH.."sky.png")
	element:SetName("Layer_4")
	compositionsky:AddElement(element)
	element:SetHotSpot(318, 85.5)
	element:SetParentElement(compositionsky)
 
	effector = element:GetEffector()
	effector:SetLifeTime(0, 7)
	effector:SetKey(_TRACK_X, 0, 291)
	effector:SetKey(_TRACK_Y, 0, 139)
	effector:SetKey(_TRACK_X, 6.95833333333333, 412)
	effector:SetKey(_TRACK_Y, 6.95833333333333, 139)
	effector:SetKey(_TRACK_O, 2.75, 1)
	effector:SetKey(_TRACK_O, 6.95833333333333, 0)
	effector:Play()
 
 
	-- Layer Layer_5
	element = CreateCompositionElement(PREFIX_PATH.."sky.png")
	element:SetName("Layer_5")
	compositionsky:AddElement(element)
	element:SetHotSpot(318, 85.5)
	element:SetParentElement(compositionsky)
 
	effector = element:GetEffector()
	effector:SetLifeTime(0, 7)
	effector:SetKey(_TRACK_X, 0, 164)
	effector:SetKey(_TRACK_Y, 0, 139)
	effector:SetKey(_TRACK_X, 6.95833333333333, 289)
	effector:SetKey(_TRACK_Y, 6.95833333333333, 139)
	effector:SetKey(_TRACK_O, 0, 0)
	effector:SetKey(_TRACK_O, 2.75, 1)
	effector:Play()
 
	compositionsky:Play()
 
	return compositionsky
end
 
