--// Local auxiliary functions - - - - - - - - - - - - - - - - - - - - - - - -

--// 1.	rename:					" -> '
--// 2. comment root compositions routine:
--//	"createComposition10_UndergroundGarden = function()"
--// 3. add auxiliaru routines for managing animations: 
--		auxPlayUndergroundGardenAnimation(), 
--		auxGetUndergroundGardenAnimation(), 
--		auxCreateUndergroundGardenAnimations()
--// 4. replace CreateCompositionElement() with auxCreateCompositionElement() for some corrections ...

------------------------------------------------------------------------------
--
function auxPlayUndergroundGardenAnimation(compositionName)
    local composition = auxGetUndergroundGardenAnimation(compositionName);
    composition:SetVisible(true);
    composition:Play();
end

------------------------------------------------------------------------------
--
function auxHideUndergroundGardenAnimation(compositionName)
    local composition = auxGetUndergroundGardenAnimation(compositionName);
    composition:Stop();
    composition:SetVisible(false);
end

------------------------------------------------------------------------------
--
function auxGetUndergroundGardenAnimation(compositionName)
    assert(undergroundGardenCompositions ~= nil and compositionName ~= nil);
	assert(undergroundGardenCompositions[compositionName] ~= nil and 'Composition with specified name not exists !');

    return undergroundGardenCompositions[compositionName];
end

-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--

function CreateComposition(parent, compositionRoutine, name, x,y,z, hotSpotX,hotSpotY, duration, isCyclic)
    assert(parent ~= nil and compositionRoutine ~= nil and name ~= nil and z ~= nil and duration ~= nil);

    local element = compositionRoutine();
    element:SetName(name);
    element:SetHotSpot(hotSpotX,hotSpotY);
    element:SetXY(x, y);
    assert(z - parent:GetZ());
    element:SetZ(z - parent:GetZ());
    element:AttachTo(parent);

    element:SetScaleX(1);
    element:SetScaleY(1);
    element:SetAngle(0);
    element:SetOpacity(1);
    
    if (isCyclic == true) then
        element:SetDuration(duration);
        element:SetCyclic(true);
	else
		element:SetDestroysOnEnd(false);
    end
	element:Stop();
    element:SetVisible(false);
    element:AssignClippingRect(parent);
	element:SetConsiderParentOpacity(true);

	return element;
end

-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function auxCreateCompositionElement(resourceName)
	local element = CreateCompositionElement(resourceName);
    local texName = string.sub(resourceName, string.len('data/Texture/Scenes/10_UndergroundGarden/Animations/') + 1);

	--// set up flies animation
	if (texName == 'Env/Comp 1_[00-03].png') then
		local anim = element:GetTexture();
		anim:Stop();
		anim:SetTextureRect(0,0, 40,40);
		anim:SetFrames(4);
		anim:SetFrame(0);
		anim:SetSpeed(30.0);
		anim:SetMode(HGEANIM_FWD + HGEANIM_LOOP);
		anim:Play();
    end

    --// set additive alpha blending mode for light & flare objects without alpha chanel (*.jpg)
    if (texName == 'Env/EF_green_lights.jpg' or
		texName == 'Env/EF_light02.jpg') then

        element:GetTexture():SetBlendMode(0);
    end
	return element;
end

------------------------------------------------------------------------------
--
function auxCreateUndergroundGardenAnimations(parent)
    assert(parent ~= nil);

    undergroundGardenCompositions = {};
    local CreateAndRegisterComposition = function (parent, compositionRoutine, name, x,y,z, hotSpotX,hotSpotY, duration, isCyclic)
        local element = CreateComposition(parent, compositionRoutine, name, x,y,z, hotSpotX,hotSpotY, duration, isCyclic);
        undergroundGardenCompositions[element:GetName()] = element;
    end

	--//
    CreateAndRegisterComposition(parent, createCompositionEnvTop,	'EnvTop',	0,0,108.4, 512,384, 10, true);
    CreateAndRegisterComposition(parent, createCompositionAnt1,		'Ant1',		0,0,108.3, 512,384, 10, false);
    CreateAndRegisterComposition(parent, createCompositionAnt2,		'Ant2',		0,0,108.2, 512,384, 10, false);
    CreateAndRegisterComposition(parent, createCompositionGroundFog,'GroundFog',0,0,108.1, 512,384, 10, true);
end

------------------------------------------------------------------------------
--createComposition10_UndergroundGarden = function()
--
--    local composition10_UndergroundGarden = CreateCompositionSequence();
--    local compositionDuration = 10;
--    composition10_UndergroundGarden:SetDuration(compositionDuration);
--
--
--    -- Layer Layer_1
--    local element = createCompositionEnvTop();
--    element:SetName('Layer_1');
--    composition10_UndergroundGarden:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(composition10_UndergroundGarden);
--    element:SetXY(512, 384);
--
--    element:SetScaleX(1);
--    element:SetScaleY(1);
--    element:SetAngle(0);
--    element:SetOpacity(1);
--
--    effector = element:GetEffector();
--    effector:SetLifeTime(0, 10);
--
--
--    effector:Play();
--
--
--    -- Layer Layer_2
--    local element = createCompositionAnt1();
--    element:SetName('Layer_2');
--    composition10_UndergroundGarden:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(composition10_UndergroundGarden);
--    element:SetXY(512, 384);
--
--    element:SetScaleX(1);
--    element:SetScaleY(1);
--    element:SetAngle(0);
--    element:SetOpacity(1);
--
--    effector = element:GetEffector();
--    effector:SetLifeTime(0, 10);
--
--
--    effector:Play();
--
--
--    -- Layer Layer_3
--    local element = createCompositionAnt2();
--    element:SetName('Layer_3');
--    composition10_UndergroundGarden:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(composition10_UndergroundGarden);
--    element:SetXY(512, 384);
--
--    element:SetScaleX(1);
--    element:SetScaleY(1);
--    element:SetAngle(0);
--    element:SetOpacity(1);
--
--    effector = element:GetEffector();
--    effector:SetLifeTime(0, 10);
--
--
--    effector:Play();
--
--
--    -- Layer Layer_4
--    local element = createCompositionGroundFog();
--    element:SetName('Layer_4');
--    composition10_UndergroundGarden:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(composition10_UndergroundGarden);
--    element:SetXY(512, 384);
--
--    element:SetScaleX(1);
--    element:SetScaleY(1);
--    element:SetAngle(0);
--    element:SetOpacity(1);
--
--    effector = element:GetEffector();
--    effector:SetLifeTime(0, 10);
--
--
--    effector:Play();
--
--
--    -- Layer BG
--    local element = auxCreateCompositionElement('data/Texture/Scenes/10_UndergroundGarden/Animations/Env/10_UndergroundGarden.jpg');
--    element:SetName('BG');
--    composition10_UndergroundGarden:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(composition10_UndergroundGarden);
--    element:SetXY(512, 384);
--
--    element:SetScaleX(1);
--    element:SetScaleY(1);
--    element:SetAngle(0);
--    element:SetOpacity(1);
--
--    effector = element:GetEffector();
--    effector:SetLifeTime(0, 10);
--
--
--    effector:Play();
--
--    composition10_UndergroundGarden:Play();
--
--    return composition10_UndergroundGarden;
--end

createCompositionAnt1 = function()

    local compositionAnt1 = CreateCompositionSequence();
    local compositionDuration = 10;
    compositionAnt1:SetDuration(compositionDuration);


    -- Layer ant2
    local element = auxCreateCompositionElement('data/Texture/Scenes/10_UndergroundGarden/Animations/Env/Comp 1_[00-03].png');
    element:SetName('ant2');
    compositionAnt1:AddElement(element);
    element:SetHotSpot(20, 20);
    element:SetParentElement(compositionAnt1);

    effector = element:GetEffector();
    effector:SetLifeTime(0, 10);

    effector:SetKey(_TRACK_X, 0, 222.635131835938);
    effector:SetKey(_TRACK_Y, 0, 300.716217041016);
    effector:SetKey(_TRACK_X, 0.08, 229.635131835938);
    effector:SetKey(_TRACK_Y, 0.08, 298.216217041016);
    effector:SetKey(_TRACK_X, 0.28, 240.635131835938);
    effector:SetKey(_TRACK_Y, 0.28, 293.466217041016);
    effector:SetKey(_TRACK_X, 0.52, 253.260131835938);
    effector:SetKey(_TRACK_Y, 0.52, 282.966217041016);
    effector:SetKey(_TRACK_X, 0.76, 262.760131835938);
    effector:SetKey(_TRACK_Y, 0.76, 266.716217041016);
    effector:SetKey(_TRACK_X, 1.04, 275.760131835938);
    effector:SetKey(_TRACK_Y, 1.04, 253.216217041016);
    effector:SetKey(_TRACK_X, 1.36, 296.510131835938);
    effector:SetKey(_TRACK_Y, 1.36, 244.466217041016);
    effector:SetKey(_TRACK_X, 1.68, 316.260131835938);
    effector:SetKey(_TRACK_Y, 1.68, 229.216217041016);
    effector:SetKey(_TRACK_X, 2, 325.260131835938);
    effector:SetKey(_TRACK_Y, 2, 207.966217041016);
    effector:SetKey(_TRACK_X, 2.44, 329.010131835938);
    effector:SetKey(_TRACK_Y, 2.44, 182.716217041016);
    effector:SetKey(_TRACK_X, 2.8, 341.510131835938);
    effector:SetKey(_TRACK_Y, 2.8, 167.716217041016);
    effector:SetKey(_TRACK_X, 3.08, 361.010131835938);
    effector:SetKey(_TRACK_Y, 3.08, 165.966217041016);
    effector:SetKey(_TRACK_X, 3.36, 372.760131835938);
    effector:SetKey(_TRACK_Y, 3.36, 178.716217041016);
    effector:SetKey(_TRACK_X, 3.64, 389.260131835938);
    effector:SetKey(_TRACK_Y, 3.64, 188.216217041016);
    effector:SetKey(_TRACK_X, 4, 410.760131835938);
    effector:SetKey(_TRACK_Y, 4, 184.216217041016);
    effector:SetKey(_TRACK_X, 4.4, 419.510131835938);
    effector:SetKey(_TRACK_Y, 4.4, 163.716217041016);
    effector:SetKey(_TRACK_X, 4.72, 422.010131835938);
    effector:SetKey(_TRACK_Y, 4.72, 141.716217041016);
    effector:SetKey(_TRACK_X, 5.12, 437.010131835938);
    effector:SetKey(_TRACK_Y, 5.12, 126.716217041016);
    effector:SetKey(_TRACK_X, 5.52, 463.260131835938);
    effector:SetKey(_TRACK_Y, 5.52, 121.966217041016);
    effector:SetKey(_TRACK_X, 5.88, 486.510131835938);
    effector:SetKey(_TRACK_Y, 5.88, 110.216217041016);
    effector:SetKey(_TRACK_X, 6.2, 502.510131835938);
    effector:SetKey(_TRACK_Y, 6.2, 92.2162170410156);
    effector:SetKey(_TRACK_X, 6.56, 511.510131835938);
    effector:SetKey(_TRACK_Y, 6.56, 75.4662170410156);
    effector:SetKey(_TRACK_X, 6.92, 518.510131835938);
    effector:SetKey(_TRACK_Y, 6.92, 54.9662170410156);
    effector:SetKey(_TRACK_X, 7.28, 514.510131835938);
    effector:SetKey(_TRACK_Y, 7.28, 35.2162170410156);
    effector:SetKey(_TRACK_X, 7.56, 500.760131835938);
    effector:SetKey(_TRACK_Y, 7.56, 30.4662170410156);
    effector:SetKey(_TRACK_X, 7.88, 484.260131835938);
    effector:SetKey(_TRACK_Y, 7.88, 35.4662170410156);
    effector:SetKey(_TRACK_X, 8.16, 467.510131835938);
    effector:SetKey(_TRACK_Y, 8.16, 35.7162170410156);
    effector:SetKey(_TRACK_X, 8.48, 453.760131835938);
    effector:SetKey(_TRACK_Y, 8.48, 28.9662170410156);
    effector:SetKey(_TRACK_X, 8.84, 447.760131835938);
    effector:SetKey(_TRACK_Y, 8.84, 12.2162170410156);
    effector:SetKey(_TRACK_X, 9.2, 449.510131835938);
    effector:SetKey(_TRACK_Y, 9.2, -5.78378295898438);
    effector:SetKey(_TRACK_X, 9.52, 460.010131835938);
    effector:SetKey(_TRACK_Y, 9.52, -24.2837829589844);
    effector:SetKey(_TRACK_SX, 0, 0.8);
    effector:SetKey(_TRACK_SY, 0, 0.8);
    effector:SetKey(_TRACK_SX, 0.08, 0.9);
    effector:SetKey(_TRACK_SY, 0.08, 0.9);
    effector:SetKey(_TRACK_SX, 2.44, 0.7);
    effector:SetKey(_TRACK_SY, 2.44, 0.7);
    effector:SetKey(_TRACK_SX, 7.56, 0.6);
    effector:SetKey(_TRACK_SY, 7.56, 0.6);
    effector:SetKey(_TRACK_SX, 8.16, 0.5);
    effector:SetKey(_TRACK_SY, 8.16, 0.5);
    effector:SetKey(_TRACK_SX, 9.52, 0.45);
    effector:SetKey(_TRACK_SY, 9.52, 0.45);
    effector:SetKey(_TRACK_A, 0, 1.1221521531178);
    effector:SetKey(_TRACK_A, 0.36, 0.8767215562714);
    effector:SetKey(_TRACK_A, 0.52, 0.64747406003384);
    effector:SetKey(_TRACK_A, 0.64, 0.44761490822482);
    effector:SetKey(_TRACK_A, 0.8, 0.54763272823681);
    effector:SetKey(_TRACK_A, 1.04, 0.96140027954832);
    effector:SetKey(_TRACK_A, 1.28, 1.15519367466252);
    effector:SetKey(_TRACK_A, 1.52, 0.82887789488138);
    effector:SetKey(_TRACK_A, 1.76, 0.43452728053995);
    effector:SetKey(_TRACK_A, 2.04, 0.24721996379024);
    effector:SetKey(_TRACK_A, 2.32, 0.17769574154394);
    effector:SetKey(_TRACK_A, 2.6, 0.71379913155113);
    effector:SetKey(_TRACK_A, 2.92, 1.40109305199247);
    effector:SetKey(_TRACK_A, 3.16, 2.36927531106355);
    effector:SetKey(_TRACK_A, 3.52, 2.00924038904803);
    effector:SetKey(_TRACK_A, 3.76, 1.41875416549917);
    effector:SetKey(_TRACK_A, 4.2, 0.5680262645125);
    effector:SetKey(_TRACK_A, 4.52, 0.08024783019216);
    effector:SetKey(_TRACK_A, 4.96, 0.93160442159483);
    effector:SetKey(_TRACK_A, 5.36, 1.38413493751294);
    effector:SetKey(_TRACK_A, 5.64, 1.16520693836455);
    effector:SetKey(_TRACK_A, 6.12, 0.7318630777234);
    effector:SetKey(_TRACK_A, 6.44, 0.47162102246297);
    effector:SetKey(_TRACK_A, 6.72, 0.3042213191575);
    effector:SetKey(_TRACK_A, 7.04, -0.32694221305234);
    effector:SetKey(_TRACK_A, 7.32, -0.92671855721828);
    effector:SetKey(_TRACK_A, 7.48, -1.24232344268107);
    effector:SetKey(_TRACK_A, 7.64, -1.83874371088788);
    effector:SetKey(_TRACK_A, 7.88, -1.69504053078983);
    effector:SetKey(_TRACK_A, 8.12, -1.40638836370045);
    effector:SetKey(_TRACK_A, 8.4, -0.87419633483826);
    effector:SetKey(_TRACK_A, 8.48, -0.44779005118092);
    effector:SetKey(_TRACK_A, 8.88, -0.02101261197264);
    effector:SetKey(_TRACK_A, 9.12, 0.31419583171983);
    effector:SetKey(_TRACK_A, 9.4, 0.6170600076308);
    effector:SetKey(_TRACK_O, 0, 0);
    effector:SetKey(_TRACK_O, 0.08, 1);

    effector:Play();

    compositionAnt1:Play();

    return compositionAnt1;
end

createCompositionAnt2 = function()

    local compositionAnt2 = CreateCompositionSequence();
    local compositionDuration = 10;
    compositionAnt2:SetDuration(compositionDuration);


    -- Layer ant1
    local element = auxCreateCompositionElement('data/Texture/Scenes/10_UndergroundGarden/Animations/Env/Comp 1_[00-03].png');
    element:SetName('ant1');
    compositionAnt2:AddElement(element);
    element:SetHotSpot(20, 20);
    element:SetParentElement(compositionAnt2);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(0, 10);

    effector:SetKey(_TRACK_X, 0, 1003.71621704102);
    effector:SetKey(_TRACK_Y, 0, 790.945953369141);
    effector:SetKey(_TRACK_X, 0.351484375, 1003.21621704102);
    effector:SetKey(_TRACK_Y, 0.351484375, 764.945953369141);
    effector:SetKey(_TRACK_X, 0.7987890625, 987.216217041016);
    effector:SetKey(_TRACK_Y, 0.7987890625, 738.945953369141);
    effector:SetKey(_TRACK_X, 1.2141796875, 990.466306436704);
    effector:SetKey(_TRACK_Y, 1.2141796875, 712.195692955613);
    effector:SetKey(_TRACK_X, 1.62953125, 1007.71621704102);
    effector:SetKey(_TRACK_Y, 1.62953125, 690.445953369141);
    effector:SetKey(_TRACK_X, 2.2366015625, 1014.21621704102);
    effector:SetKey(_TRACK_Y, 2.2366015625, 658.445953369141);
    effector:SetKey(_TRACK_X, 2.8756640625, 1006.21621704102);
    effector:SetKey(_TRACK_Y, 2.8756640625, 616.945953369141);
    effector:SetKey(_TRACK_X, 3.45078125, 1003.21621704102);
    effector:SetKey(_TRACK_Y, 3.45078125, 578.945953369141);
    effector:SetKey(_TRACK_X, 4.1217578125, 1008.71621704102);
    effector:SetKey(_TRACK_Y, 4.1217578125, 537.945953369141);
    effector:SetKey(_TRACK_X, 4.792734375, 1002.71621704102);
    effector:SetKey(_TRACK_Y, 4.792734375, 498.945953369141);
    effector:SetKey(_TRACK_X, 5.3998046875, 1010.21621704102);
    effector:SetKey(_TRACK_Y, 5.3998046875, 464.445953369141);
    effector:SetKey(_TRACK_X, 6.0388671875, 1007.71621704102);
    effector:SetKey(_TRACK_Y, 6.0388671875, 422.445953369141);
    effector:SetKey(_TRACK_X, 6.677890625, 999.216217041016);
    effector:SetKey(_TRACK_Y, 6.677890625, 380.445953369141);
    effector:SetKey(_TRACK_X, 7.3169140625, 1004.21621704102);
    effector:SetKey(_TRACK_Y, 7.3169140625, 341.445953369141);
    effector:SetKey(_TRACK_X, 7.9559375, 1012.21621704102);
    effector:SetKey(_TRACK_Y, 7.9559375, 307.445953369141);
    effector:SetKey(_TRACK_X, 8.6, 1002.71621704102);
    effector:SetKey(_TRACK_Y, 8.6, 273.945953369141);
    effector:SetKey(_TRACK_X, 9.2, 1010.71621704102);
    effector:SetKey(_TRACK_Y, 9.2, 243.445953369141);
    effector:SetKey(_TRACK_X, 9.96, 1056.71621704102);
    effector:SetKey(_TRACK_Y, 9.96, 222.945953369141);
    effector:SetKey(_TRACK_SX, 0, 1.1);
    effector:SetKey(_TRACK_SY, 0, 1.1);
    effector:SetKey(_TRACK_SX, 5, 0.9);
    effector:SetKey(_TRACK_SY, 5, 0.9);
    effector:SetKey(_TRACK_SX, 6.56, 0.80564516129032);
    effector:SetKey(_TRACK_SY, 6.56, 0.80564516129032);
    effector:SetKey(_TRACK_SX, 6.88, 0.9);
    effector:SetKey(_TRACK_SY, 6.88, 0.9);
    effector:SetKey(_TRACK_SX, 7.72, 0.85);
    effector:SetKey(_TRACK_SY, 7.72, 0.85);
    effector:SetKey(_TRACK_SX, 8.08, 0.7);
    effector:SetKey(_TRACK_SY, 8.08, 0.7);
    effector:SetKey(_TRACK_SX, 9.96, 0.65);
    effector:SetKey(_TRACK_SY, 9.96, 0.65);
    effector:SetKey(_TRACK_A, 0, -0.01768628282553);
    effector:SetKey(_TRACK_A, 0.4, -0.53375996937772);
    effector:SetKey(_TRACK_A, 0.76, -0.37309182977733);
    effector:SetKey(_TRACK_A, 0.92, 0.09460482339086);
    effector:SetKey(_TRACK_A, 1.16, 0.32308381581037);
    effector:SetKey(_TRACK_A, 1.28, 0.56711706071119);
    effector:SetKey(_TRACK_A, 1.56, 0.49146950427893);
    effector:SetKey(_TRACK_A, 1.8, 0.32556813548297);
    effector:SetKey(_TRACK_A, 2.16, 0.0671327160308);
    effector:SetKey(_TRACK_A, 2.4, -0.21994990423674);
    effector:SetKey(_TRACK_A, 3, -0.12379225175168);
    effector:SetKey(_TRACK_A, 3.4, -0.03404998988559);
    effector:SetKey(_TRACK_A, 3.64, 0.21688077207029);
    effector:SetKey(_TRACK_A, 4, 0.07842729032757);
    effector:SetKey(_TRACK_A, 4.32, -0.21893852519405);
    effector:SetKey(_TRACK_A, 4.64, -0.16869120034862);
    effector:SetKey(_TRACK_A, 5, 0.31126586007165);
    effector:SetKey(_TRACK_A, 5.4, 0.08378067229093);
    effector:SetKey(_TRACK_A, 5.76, -0.08909839487153);
    effector:SetKey(_TRACK_A, 6.16, -0.26344941151193);
    effector:SetKey(_TRACK_A, 6.84, 0.10995609540449);
    effector:SetKey(_TRACK_A, 7.28, 0.19051686954418);
    effector:SetKey(_TRACK_A, 7.68, 0.29397783838733);
    effector:SetKey(_TRACK_A, 7.92, -0.00751686918292);
    effector:SetKey(_TRACK_A, 8.24, -0.36860321011187);
    effector:SetKey(_TRACK_A, 8.56, -0.12362308558663);
    effector:SetKey(_TRACK_A, 8.76, 0.26006643259635);
    effector:SetKey(_TRACK_A, 9.2, 0.78972193640068);
    effector:SetKey(_TRACK_A, 9.56, 1.16519658164265);

    effector:Play();

    compositionAnt2:Play();

    return compositionAnt2;
end

createCompositionEnvTop = function()

    local compositionEnvTop = CreateCompositionSequence();
    local compositionDuration = 10;
    compositionEnvTop:SetDuration(compositionDuration);


    -- Layer light
    local element = auxCreateCompositionElement('data/Texture/Scenes/10_UndergroundGarden/Animations/Env/EF_light02.jpg');
    element:SetName('light');
    compositionEnvTop:AddElement(element);
    element:SetHotSpot(107, 83);
    element:SetParentElement(compositionEnvTop);
    element:SetScaleX(4.45773496758026);
    element:SetScaleY(7.42572297585726);
    element:SetAngle(0.86857470735116);

    effector = element:GetEffector();
    effector:SetLifeTime(0, 10);

    effector:SetKey(_TRACK_X, 0, 280);
    effector:SetKey(_TRACK_Y, 0, 126);
    effector:SetKey(_TRACK_X, 9.96, 574);
    effector:SetKey(_TRACK_Y, 9.96, 152);
    effector:SetKey(_TRACK_O, 0, 0);
    effector:SetKey(_TRACK_O, 0.8, 0.4);
    effector:SetKey(_TRACK_O, 1.76, 0);
    effector:SetKey(_TRACK_O, 2.92, 0.79999998390282);
    effector:SetKey(_TRACK_O, 4.2, 0.20000004437313);
    effector:SetKey(_TRACK_O, 5.32, 0.94276921700518);
    effector:SetKey(_TRACK_O, 6.52, 0.29614178406715);
    effector:SetKey(_TRACK_O, 7.56, 0.94276921467205);
    effector:SetKey(_TRACK_O, 8.8, 0.2);
    effector:SetKey(_TRACK_O, 9.36, 0.4);
    effector:SetKey(_TRACK_O, 9.96, 0);

    effector:Play();


    -- Layer green_light
    local element = createCompositionGreen_lights_all();
    element:SetName('green_light');
    compositionEnvTop:AddElement(element);
    element:SetHotSpot(512, 384);
    element:SetParentElement(compositionEnvTop);
    element:SetXY(512, 384);

    element:SetScaleX(1);
    element:SetScaleY(1);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(0, 10);


    effector:Play();

    compositionEnvTop:Play();

    return compositionEnvTop;
end

createCompositionFog_01 = function()

    local compositionFog_01 = CreateCompositionSequence();
    local compositionDuration = 10;
    compositionFog_01:SetDuration(compositionDuration);


    -- Layer Layer_1
    local element = auxCreateCompositionElement('data/Texture/Scenes/10_UndergroundGarden/Animations/Env/EF_fog01.png');
    element:SetName('Layer_1');
    compositionFog_01:AddElement(element);
    element:SetHotSpot(74, 28.5);
    element:SetParentElement(compositionFog_01);
    element:SetAngle(0);

    effector = element:GetEffector();
    effector:SetLifeTime(0, 10);

    effector:SetKey(_TRACK_X, 0, 132.837844848633);
    effector:SetKey(_TRACK_Y, 0, 56.8783721923828);
    effector:SetKey(_TRACK_X, 1.72, 128.914649948769);
    effector:SetKey(_TRACK_Y, 1.72, 56.3740250380495);
    effector:SetKey(_TRACK_X, 3.16, 125.712844848633);
    effector:SetKey(_TRACK_Y, 3.16, 54.1283721923828);
    effector:SetKey(_TRACK_X, 4.92, 128.517380190561);
    effector:SetKey(_TRACK_Y, 4.92, 51.6370984234097);
    effector:SetKey(_TRACK_X, 6.52, 132.224222300271);
    effector:SetKey(_TRACK_Y, 6.52, 51.1062480956177);
    effector:SetKey(_TRACK_X, 8.04, 136.757539984266);
    effector:SetKey(_TRACK_Y, 8.04, 52.8877939396206);
    effector:SetKey(_TRACK_X, 9.04, 137.148528543685);
    effector:SetKey(_TRACK_Y, 9.04, 55.7912445408106);
    effector:SetKey(_TRACK_X, 9.96, 132.837844848633);
    effector:SetKey(_TRACK_Y, 9.96, 56.8783721923828);
    effector:SetKey(_TRACK_SX, 0, 1);
    effector:SetKey(_TRACK_SY, 0, 1);
    effector:SetKey(_TRACK_SX, 4.72, 1.2);
    effector:SetKey(_TRACK_SY, 4.72, 1.2);
    effector:SetKey(_TRACK_SX, 9.96, 1);
    effector:SetKey(_TRACK_SY, 9.96, 1);
    effector:SetKey(_TRACK_O, 0, 0.2);
    effector:SetKey(_TRACK_O, 0.779765625, 0.79120879120879);
    effector:SetKey(_TRACK_O, 1.72, 0.4204776526121);
    effector:SetKey(_TRACK_O, 2.84, 0.89206617882568);
    effector:SetKey(_TRACK_O, 3.8, 0.28203821495478);
    effector:SetKey(_TRACK_O, 4.779765625, 0.99120879120879);
    effector:SetKey(_TRACK_O, 5.92, 0.63582788896792);
    effector:SetKey(_TRACK_O, 7.12, 0.89206617882568);
    effector:SetKey(_TRACK_O, 8.24, 0.4204776526121);
    effector:SetKey(_TRACK_O, 9.219765625, 0.79120879120879);
    effector:SetKey(_TRACK_O, 10, 0.2);

    effector:Play();

    compositionFog_01:Play();

    return compositionFog_01;
end

createCompositionGreen_lights_01 = function()

    local compositionGreen_lights_01 = CreateCompositionSequence();
    local compositionDuration = 1.2;
    compositionGreen_lights_01:SetDuration(compositionDuration);


    -- Layer Layer_1
    local element = auxCreateCompositionElement('data/Texture/Scenes/10_UndergroundGarden/Animations/Env/EF_green_lights.jpg');
    element:SetName('Layer_1');
    compositionGreen_lights_01:AddElement(element);
    element:SetHotSpot(58.5, 20);
    element:SetParentElement(compositionGreen_lights_01);
    element:SetXY(60.005126953125, 37.9615325927734);

    element:SetScaleX(1);
    element:SetScaleY(1);
    element:SetAngle(0);

    effector = element:GetEffector();
    effector:SetLifeTime(0, 1.2);

    effector:SetKey(_TRACK_O, 0, 0);
    effector:SetKey(_TRACK_O, 0.44, 1);
    effector:SetKey(_TRACK_O, 1.16, 0);

    effector:Play();

    compositionGreen_lights_01:Play();

    return compositionGreen_lights_01;
end

createCompositionGreen_lights_all = function()

    local compositionGreen_lights_all = CreateCompositionSequence();
    local compositionDuration = 10;
    compositionGreen_lights_all:SetDuration(compositionDuration);


    -- Layer Layer_1
    local element = createCompositionGreen_lights_01();
    element:SetName('Layer_1');
    compositionGreen_lights_all:AddElement(element);
    element:SetHotSpot(60, 40);
    element:SetParentElement(compositionGreen_lights_all);
    element:SetXY(67, 347);

    element:SetScaleX(-0.7);
    element:SetScaleY(0.45);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(8.8, 10);


    effector:Play();


    -- Layer Layer_2
    local element = createCompositionGreen_lights_01();
    element:SetName('Layer_2');
    compositionGreen_lights_all:AddElement(element);
    element:SetHotSpot(60, 40);
    element:SetParentElement(compositionGreen_lights_all);
    element:SetXY(46, 398);

    element:SetScaleX(1.01666666666667);
    element:SetScaleY(0.95);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(8, 9.2);


    effector:Play();


    -- Layer Layer_3
    local element = createCompositionGreen_lights_01();
    element:SetName('Layer_3');
    compositionGreen_lights_all:AddElement(element);
    element:SetHotSpot(60, 40);
    element:SetParentElement(compositionGreen_lights_all);
    element:SetXY(580, 302);

    element:SetScaleX(0.66666666666667);
    element:SetScaleY(0.475);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(7, 8.2);


    effector:Play();


    -- Layer Layer_4
    local element = createCompositionGreen_lights_01();
    element:SetName('Layer_4');
    compositionGreen_lights_all:AddElement(element);
    element:SetHotSpot(60, 40);
    element:SetParentElement(compositionGreen_lights_all);
    element:SetXY(67, 347);

    element:SetScaleX(-0.7);
    element:SetScaleY(0.45);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(3.4, 4.6);


    effector:Play();


    -- Layer Layer_5
    local element = createCompositionGreen_lights_01();
    element:SetName('Layer_5');
    compositionGreen_lights_all:AddElement(element);
    element:SetHotSpot(60, 40);
    element:SetParentElement(compositionGreen_lights_all);
    element:SetXY(46, 398);

    element:SetScaleX(1.01666666666667);
    element:SetScaleY(0.95);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(3.24, 4.44);


    effector:Play();


    -- Layer Layer_6
    local element = createCompositionGreen_lights_01();
    element:SetName('Layer_6');
    compositionGreen_lights_all:AddElement(element);
    element:SetHotSpot(60, 40);
    element:SetParentElement(compositionGreen_lights_all);
    element:SetXY(587, 295);

    element:SetScaleX(0.66666666666667);
    element:SetScaleY(0.475);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(5.12, 6.32);


    effector:Play();


    -- Layer Layer_7
    local element = createCompositionGreen_lights_01();
    element:SetName('Layer_7');
    compositionGreen_lights_all:AddElement(element);
    element:SetHotSpot(60, 40);
    element:SetParentElement(compositionGreen_lights_all);
    element:SetXY(580, 302);

    element:SetScaleX(0.66666666666667);
    element:SetScaleY(0.475);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(2.92, 4.12);


    effector:Play();


    -- Layer Layer_8
    local element = createCompositionGreen_lights_01();
    element:SetName('Layer_8');
    compositionGreen_lights_all:AddElement(element);
    element:SetHotSpot(60, 40);
    element:SetParentElement(compositionGreen_lights_all);
    element:SetXY(580, 302);

    element:SetScaleX(0.66666666666667);
    element:SetScaleY(0.475);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(5.88, 7.08);


    effector:Play();


    -- Layer Layer_9
    local element = createCompositionGreen_lights_01();
    element:SetName('Layer_9');
    compositionGreen_lights_all:AddElement(element);
    element:SetHotSpot(60, 40);
    element:SetParentElement(compositionGreen_lights_all);
    element:SetXY(580, 302);

    element:SetScaleX(0.66666666666667);
    element:SetScaleY(0.475);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(1.2, 2.4);


    effector:Play();


    -- Layer Layer_10
    local element = createCompositionGreen_lights_01();
    element:SetName('Layer_10');
    compositionGreen_lights_all:AddElement(element);
    element:SetHotSpot(60, 40);
    element:SetParentElement(compositionGreen_lights_all);
    element:SetXY(795, 357);

    element:SetScaleX(1);
    element:SetScaleY(1);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(4.44, 5.64);


    effector:Play();


    -- Layer Layer_11
    local element = createCompositionGreen_lights_01();
    element:SetName('Layer_11');
    compositionGreen_lights_all:AddElement(element);
    element:SetHotSpot(60, 40);
    element:SetParentElement(compositionGreen_lights_all);
    element:SetXY(855, 335);

    element:SetScaleX(1);
    element:SetScaleY(1);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(4.92, 6.12);


    effector:Play();


    -- Layer Layer_12
    local element = createCompositionGreen_lights_01();
    element:SetName('Layer_12');
    compositionGreen_lights_all:AddElement(element);
    element:SetHotSpot(60, 40);
    element:SetParentElement(compositionGreen_lights_all);
    element:SetXY(855, 335);

    element:SetScaleX(1);
    element:SetScaleY(1);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(1, 2.2);


    effector:Play();


    -- Layer Layer_13
    local element = createCompositionGreen_lights_01();
    element:SetName('Layer_13');
    compositionGreen_lights_all:AddElement(element);
    element:SetHotSpot(60, 40);
    element:SetParentElement(compositionGreen_lights_all);
    element:SetXY(795, 357);

    element:SetScaleX(1);
    element:SetScaleY(1);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(2.4, 3.6);


    effector:Play();


    -- Layer Layer_14
    local element = createCompositionGreen_lights_01();
    element:SetName('Layer_14');
    compositionGreen_lights_all:AddElement(element);
    element:SetHotSpot(60, 40);
    element:SetParentElement(compositionGreen_lights_all);
    element:SetXY(795, 357);

    element:SetScaleX(1);
    element:SetScaleY(1);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(0, 1.2);


    effector:Play();

    compositionGreen_lights_all:Play();

    return compositionGreen_lights_all;
end

createCompositionGroundFog = function()

    local compositionGroundFog = CreateCompositionSequence();
    local compositionDuration = 10;
    compositionGroundFog:SetDuration(compositionDuration);


    -- Layer fog1
    local element = createCompositionFog_01();
    element:SetName('fog1');
    compositionGroundFog:AddElement(element);
    element:SetHotSpot(128, 64);
    element:SetParentElement(compositionGroundFog);
    element:SetXY(873.281784057617, 80.8526611328125);

    element:SetScaleX(3.83399384961885);
    element:SetScaleY(3.62503898128898);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(0, 10);


    effector:Play();


    -- Layer fog2
    local element = createCompositionFog_01();
    element:SetName('fog2');
    compositionGroundFog:AddElement(element);
    element:SetHotSpot(128, 64);
    element:SetParentElement(compositionGroundFog);
    element:SetXY(423.281784057617, 706.852661132813);

    element:SetScaleX(4.92774384961885);
    element:SetScaleY(4.15628898128898);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(0, 10);


    effector:Play();


    -- Layer fog3
    local element = createCompositionFog_01();
    element:SetName('fog3');
    compositionGroundFog:AddElement(element);
    element:SetHotSpot(128, 64);
    element:SetParentElement(compositionGroundFog);
    element:SetXY(786.43049621582, 519.375732421875);

    element:SetScaleX(3.72461884961885);
    element:SetScaleY(3.28128898128898);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(0, 10);


    effector:Play();


    -- Layer fog4
    local element = createCompositionFog_01();
    element:SetName('fog4');
    compositionGroundFog:AddElement(element);
    element:SetHotSpot(128, 64);
    element:SetParentElement(compositionGroundFog);
    element:SetXY(178.594589233398, 371.02702331543);

    element:SetScaleX(0.44256756756757);
    element:SetScaleY(0.63513513513513);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(0, 10);


    effector:Play();


    -- Layer fog5
    local element = createCompositionFog_01();
    element:SetName('fog5');
    compositionGroundFog:AddElement(element);
    element:SetHotSpot(128, 64);
    element:SetParentElement(compositionGroundFog);
    element:SetXY(61.8378448486328, 399.567565917969);

    element:SetScaleX(1);
    element:SetScaleY(1);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(0, 10);


    effector:Play();


    -- Layer fog6
    local element = createCompositionFog_01();
    element:SetName('fog6');
    compositionGroundFog:AddElement(element);
    element:SetHotSpot(128, 64);
    element:SetParentElement(compositionGroundFog);
    element:SetXY(578.162170410156, 286.702713012695);

    element:SetScaleX(0.75675675675676);
    element:SetScaleY(0.75675675675676);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(0, 10);


    effector:Play();


    -- Layer fog7
    local element = createCompositionFog_01();
    element:SetName('fog7');
    compositionGroundFog:AddElement(element);
    element:SetHotSpot(128, 64);
    element:SetParentElement(compositionGroundFog);
    element:SetXY(633.945953369141, 329.513519287109);

    element:SetScaleX(1);
    element:SetScaleY(1);
    element:SetAngle(0);
    element:SetOpacity(1);

    effector = element:GetEffector();
    effector:SetLifeTime(0, 10);


    effector:Play();

    compositionGroundFog:Play();

    return compositionGroundFog;
end

