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

--// 1.	rename:					" -> '
--// 2. comment root compositions routine:
--//	""
--// 3. add auxiliaru routines for managing animations: 
--		auxPlayTempleEntranceAnimation(), 
--		auxGetTempleEntranceAnimation(), 
--		auxCreateTempleEntranceAnimations()
--// 4. replace CreateCompositionElement() with auxCreateCompositionElement() for some corrections ...

------------------------------------------------------------------------------
--
function auxPlayTempleEntranceAnimation(compositionName)
    local composition = auxGetTempleEntranceAnimation(compositionName);
    composition:SetVisible(true);
    composition:Play();
end

------------------------------------------------------------------------------
--
function auxHideTempleEntranceAnimation(compositionName)
    local composition = auxGetTempleEntranceAnimation(compositionName);
    composition:Stop();
    composition:SetVisible(false);
end

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

    return templeEntranceCompositions[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/14_TempleEntrance/Animations/') + 1);

    --// set up dragonfly animation
	if (texName == 'Env/DF1_[0000-0004].png') then
		local anim = element:GetTexture();
		anim:Stop();
		anim:SetTextureRect(0,0, 128,96);
		anim:SetFrames(5);
		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_Dust_01.jpg' or
		texName == 'Env/EF_light4_01.jpg') then

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

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

    templeEntranceCompositions = {};
    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);
        templeEntranceCompositions[element:GetName()] = element;
    end

	--//
    CreateAndRegisterComposition(parent, createCompositionDragonfly1,	'Dragonfly1',	0,0,108.3, 512,384, 10, false);
    CreateAndRegisterComposition(parent, createCompositionEnvTop,		'EnvTop',		0,0,108.2, 512,384, 10, true);
    CreateAndRegisterComposition(parent, createCompositionDragonfly2,	'Dragonfly2',	0,0,108.1, 512,384, 10, false);
end

------------------------------------------------------------------------------
--createComposition14_TempleEntrance_01 = function()
--
--    local composition14_TempleEntrance_01 = CreateCompositionSequence();
--    local compositionDuration = 10;
--    composition14_TempleEntrance_01:SetDuration(compositionDuration);
--
--
--    -- Layer Layer_1
--    local element = createCompositionDragonfly1();
--    element:SetName('Layer_1');
--    composition14_TempleEntrance_01:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(composition14_TempleEntrance_01);
--    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 = createCompositionEnvTop();
--    element:SetName('Layer_2');
--    composition14_TempleEntrance_01:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(composition14_TempleEntrance_01);
--    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 = createCompositionDragonfly2();
--    element:SetName('Layer_3');
--    composition14_TempleEntrance_01:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(composition14_TempleEntrance_01);
--    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 = auxCreateCompositionElement('data/Texture/Scenes/14_TempleEntrance/Animations/Env/14_TempleEntrance_01.jpg');
--    element:SetName('Layer_4');
--    composition14_TempleEntrance_01:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(composition14_TempleEntrance_01);
--    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();
--
--    composition14_TempleEntrance_01:Play();
--
--    return composition14_TempleEntrance_01;
--end

createCompositionDragonfly1 = function()

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


    -- Layer Layer_1
    local element = auxCreateCompositionElement('data/Texture/Scenes/14_TempleEntrance/Animations/Env/DF1_[0000-0004].png');
    element:SetName('Layer_1');
    compositionDragonfly1:AddElement(element);
    element:SetHotSpot(64, 48);
    element:SetParentElement(compositionDragonfly1);
    element:SetAngle(0);
    element:SetOpacity(1);

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

    effector:SetKey(_TRACK_X, 0, -71.7508697509766);
    effector:SetKey(_TRACK_Y, 0, 236.512100219727);
    effector:SetKey(_TRACK_X, 0.24, 38.5328674316406);
    effector:SetKey(_TRACK_Y, 0.24, 228.539779663086);
    effector:SetKey(_TRACK_X, 0.48, 148.816604614258);
    effector:SetKey(_TRACK_Y, 0.48, 260.429061889648);
    effector:SetKey(_TRACK_X, 0.8, 237.8408203125);
    effector:SetKey(_TRACK_Y, 0.8, 310.92041015625);
    effector:SetKey(_TRACK_X, 1.48, 237.8408203125);
    effector:SetKey(_TRACK_Y, 1.48, 310.92041015625);
    effector:SetKey(_TRACK_X, 1.68, 329.522476196289);
    effector:SetKey(_TRACK_Y, 1.68, 329.522491455078);
    effector:SetKey(_TRACK_X, 1.88, 389.314865112305);
    effector:SetKey(_TRACK_Y, 1.88, 300.290664672852);
    effector:SetKey(_TRACK_X, 2.04, 422.532852172852);
    effector:SetKey(_TRACK_Y, 2.04, 247.141876220703);
    effector:SetKey(_TRACK_X, 2.2, 401.273330688477);
    effector:SetKey(_TRACK_Y, 2.2, 191.335647583008);
    effector:SetKey(_TRACK_X, 2.44, 342.809661865234);
    effector:SetKey(_TRACK_Y, 2.44, 147.487899780273);
    effector:SetKey(_TRACK_X, 2.72, 253.785446166992);
    effector:SetKey(_TRACK_Y, 2.72, 150.14533996582);
    effector:SetKey(_TRACK_X, 3.04, 182.034576416016);
    effector:SetKey(_TRACK_Y, 3.04, 183.363327026367);
    effector:SetKey(_TRACK_X, 3.32, 151.474029541016);
    effector:SetKey(_TRACK_Y, 3.32, 237.840835571289);
    effector:SetKey(_TRACK_X, 3.6, 168.74739074707);
    effector:SetKey(_TRACK_Y, 3.6, 342.809692382813);
    effector:SetKey(_TRACK_X, 3.88, 228.539779663086);
    effector:SetKey(_TRACK_Y, 3.88, 422.53288269043);
    effector:SetKey(_TRACK_X, 4.16, 304.276809692383);
    effector:SetKey(_TRACK_Y, 4.16, 475.681671142578);
    effector:SetKey(_TRACK_X, 4.44, 413.231826782227);
    effector:SetKey(_TRACK_Y, 4.44, 507.570938110352);
    effector:SetKey(_TRACK_X, 4.68, 500.927322387695);
    effector:SetKey(_TRACK_Y, 4.68, 506.242218017578);
    effector:SetKey(_TRACK_X, 4.96, 570.020751953125);
    effector:SetKey(_TRACK_Y, 4.96, 466.380630493164);
    effector:SetKey(_TRACK_X, 5.2, 591.2802734375);
    effector:SetKey(_TRACK_Y, 5.2, 397.287200927734);
    effector:SetKey(_TRACK_X, 5.44, 564.70588684082);
    effector:SetKey(_TRACK_Y, 5.44, 333.508651733398);
    effector:SetKey(_TRACK_X, 5.72, 498.269897460938);
    effector:SetKey(_TRACK_Y, 5.72, 292.318344116211);
    effector:SetKey(_TRACK_X, 5.96, 475.681655883789);
    effector:SetKey(_TRACK_Y, 5.96, 240.498275756836);
    effector:SetKey(_TRACK_X, 6.84, 475.681655883789);
    effector:SetKey(_TRACK_Y, 6.84, 240.498275756836);
    effector:SetKey(_TRACK_X, 7.12, 546.103805541992);
    effector:SetKey(_TRACK_Y, 7.12, 268.401382446289);
    effector:SetKey(_TRACK_X, 7.36, 609.882354736328);
    effector:SetKey(_TRACK_Y, 7.36, 272.387542724609);
    effector:SetKey(_TRACK_X, 7.56, 667.017303466797);
    effector:SetKey(_TRACK_Y, 7.56, 245.81315612793);
    effector:SetKey(_TRACK_X, 7.8, 716.179931640625);
    effector:SetKey(_TRACK_Y, 7.8, 190.006927490234);
    effector:SetKey(_TRACK_X, 8.04, 748.069213867188);
    effector:SetKey(_TRACK_Y, 8.04, 134.200698852539);
    effector:SetKey(_TRACK_X, 8.28, 694.920425415039);
    effector:SetKey(_TRACK_Y, 8.28, 155.460220336914);
    effector:SetKey(_TRACK_X, 8.52, 629.81315612793);
    effector:SetKey(_TRACK_Y, 8.52, 166.089981079102);
    effector:SetKey(_TRACK_X, 8.72, 559.391021728516);
    effector:SetKey(_TRACK_Y, 8.72, 155.460220336914);
    effector:SetKey(_TRACK_X, 9.08, 480.996551513672);
    effector:SetKey(_TRACK_Y, 9.08, 115.5986328125);
    effector:SetKey(_TRACK_X, 9.32, 451.764709472656);
    effector:SetKey(_TRACK_Y, 9.32, 66.4360046386719);
    effector:SetKey(_TRACK_X, 9.52, 435.820068359375);
    effector:SetKey(_TRACK_Y, 9.52, 3.98617553710938);
    effector:SetKey(_TRACK_X, 9.92, 431.833908081055);
    effector:SetKey(_TRACK_Y, 9.92, -108.955001831055);
    effector:SetKey(_TRACK_SX, 0, -1);
    effector:SetKey(_TRACK_SY, 0, 1);
    effector:SetKey(_TRACK_SX, 1.04, -0.8);
    effector:SetKey(_TRACK_SY, 1.04, 0.8);
    effector:SetKey(_TRACK_SX, 2.24, -0.8);
    effector:SetKey(_TRACK_SY, 2.24, 0.8);
    effector:SetKey(_TRACK_SX, 2.28, 0.8);
    effector:SetKey(_TRACK_SY, 2.28, 0.8);
    effector:SetKey(_TRACK_SX, 3.4, 0.8);
    effector:SetKey(_TRACK_SY, 3.4, 0.8);
    effector:SetKey(_TRACK_SX, 3.44, -0.8);
    effector:SetKey(_TRACK_SY, 3.44, 0.8);
    effector:SetKey(_TRACK_SX, 5.96, -0.6);
    effector:SetKey(_TRACK_SY, 5.96, 0.6);
    effector:SetKey(_TRACK_SX, 6.48, -0.5);
    effector:SetKey(_TRACK_SY, 6.48, 0.5);
    effector:SetKey(_TRACK_SX, 6.92, -0.6);
    effector:SetKey(_TRACK_SY, 6.92, 0.6);
    effector:SetKey(_TRACK_SX, 9.96, -0.4);
    effector:SetKey(_TRACK_SY, 9.96, 0.4);

    effector:Play();

    compositionDragonfly1:Play();

    return compositionDragonfly1;
end

createCompositionDragonfly2 = function()

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


    -- Layer Layer_1
    local element = auxCreateCompositionElement('data/Texture/Scenes/14_TempleEntrance/Animations/Env/DF1_[0000-0004].png');
    element:SetName('Layer_1');
    compositionDragonfly2:AddElement(element);
    element:SetHotSpot(64, 48);
    element:SetParentElement(compositionDragonfly2);
    element:SetOpacity(1);

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

    effector:SetKey(_TRACK_X, 0, 1096.1937713623);
    effector:SetKey(_TRACK_Y, 0, 631.141860961914);
    effector:SetKey(_TRACK_X, 0.16, 1043.04498291016);
    effector:SetKey(_TRACK_Y, 0.16, 608.553619384766);
    effector:SetKey(_TRACK_X, 0.32, 988.567474365234);
    effector:SetKey(_TRACK_Y, 0.32, 589.951538085938);
    effector:SetKey(_TRACK_X, 0.44, 947.377166748047);
    effector:SetKey(_TRACK_Y, 0.44, 585.965377807617);
    effector:SetKey(_TRACK_X, 0.6, 891.877166748047);
    effector:SetKey(_TRACK_Y, 0.6, 588.465377807617);
    effector:SetKey(_TRACK_X, 0.76, 835.377166748047);
    effector:SetKey(_TRACK_Y, 0.76, 596.465377807617);
    effector:SetKey(_TRACK_X, 0.96, 771.877166748047);
    effector:SetKey(_TRACK_Y, 0.96, 586.465377807617);
    effector:SetKey(_TRACK_X, 1.24, 706.877166748047);
    effector:SetKey(_TRACK_Y, 1.24, 546.465377807617);
    effector:SetKey(_TRACK_X, 1.44, 664.377166748047);
    effector:SetKey(_TRACK_Y, 1.44, 495.965377807617);
    effector:SetKey(_TRACK_X, 1.6, 650.877166748047);
    effector:SetKey(_TRACK_Y, 1.6, 482.965377807617);
    effector:SetKey(_TRACK_X, 2.32, 650.877166748047);
    effector:SetKey(_TRACK_Y, 2.32, 482.965377807617);
    effector:SetKey(_TRACK_X, 2.48, 690.877166748047);
    effector:SetKey(_TRACK_Y, 2.48, 491.465377807617);
    effector:SetKey(_TRACK_X, 2.64, 740.377166748047);
    effector:SetKey(_TRACK_Y, 2.64, 486.965377807617);
    effector:SetKey(_TRACK_X, 2.8, 777.377166748047);
    effector:SetKey(_TRACK_Y, 2.8, 458.465377807617);
    effector:SetKey(_TRACK_X, 2.96, 801.377166748047);
    effector:SetKey(_TRACK_Y, 2.96, 411.465377807617);
    effector:SetKey(_TRACK_X, 3.2, 823.877166748047);
    effector:SetKey(_TRACK_Y, 3.2, 342.465377807617);
    effector:SetKey(_TRACK_X, 3.44, 837.377166748047);
    effector:SetKey(_TRACK_Y, 3.44, 267.965377807617);
    effector:SetKey(_TRACK_X, 3.68, 842.377166748047);
    effector:SetKey(_TRACK_Y, 3.68, 190.965377807617);
    effector:SetKey(_TRACK_X, 3.8, 835.877166748047);
    effector:SetKey(_TRACK_Y, 3.8, 144.465377807617);
    effector:SetKey(_TRACK_X, 4.52, 835.877166748047);
    effector:SetKey(_TRACK_Y, 4.52, 144.465377807617);
    effector:SetKey(_TRACK_X, 4.68, 863.877166748047);
    effector:SetKey(_TRACK_Y, 4.68, 155.465377807617);
    effector:SetKey(_TRACK_X, 4.84, 905.877166748047);
    effector:SetKey(_TRACK_Y, 4.84, 155.465377807617);
    effector:SetKey(_TRACK_X, 5.08, 942.377166748047);
    effector:SetKey(_TRACK_Y, 5.08, 134.465377807617);
    effector:SetKey(_TRACK_X, 5.32, 964.377166748047);
    effector:SetKey(_TRACK_Y, 5.32, 85.4653778076172);
    effector:SetKey(_TRACK_X, 5.56, 966.377166748047);
    effector:SetKey(_TRACK_Y, 5.56, 49.9653778076172);
    effector:SetKey(_TRACK_X, 6.4, 966.377166748047);
    effector:SetKey(_TRACK_Y, 6.4, 49.9653778076172);
    effector:SetKey(_TRACK_X, 6.56, 942.877166748047);
    effector:SetKey(_TRACK_Y, 6.56, 68.9653778076172);
    effector:SetKey(_TRACK_X, 6.72, 900.877166748047);
    effector:SetKey(_TRACK_Y, 6.72, 85.4653778076172);
    effector:SetKey(_TRACK_X, 6.92, 849.377166748047);
    effector:SetKey(_TRACK_Y, 6.92, 93.9653778076172);
    effector:SetKey(_TRACK_X, 7.16, 768.377166748047);
    effector:SetKey(_TRACK_Y, 7.16, 91.4653778076172);
    effector:SetKey(_TRACK_X, 7.44, 698.377166748047);
    effector:SetKey(_TRACK_Y, 7.44, 73.9653778076172);
    effector:SetKey(_TRACK_X, 7.64, 631.877166748047);
    effector:SetKey(_TRACK_Y, 7.64, 67.9653778076172);
    effector:SetKey(_TRACK_X, 7.88, 560.877166748047);
    effector:SetKey(_TRACK_Y, 7.88, 77.9653778076172);
    effector:SetKey(_TRACK_X, 8.12, 497.377166748047);
    effector:SetKey(_TRACK_Y, 8.12, 103.965377807617);
    effector:SetKey(_TRACK_X, 8.36, 430.377166748047);
    effector:SetKey(_TRACK_Y, 8.36, 123.965377807617);
    effector:SetKey(_TRACK_X, 8.56, 343.877166748047);
    effector:SetKey(_TRACK_Y, 8.56, 128.965377807617);
    effector:SetKey(_TRACK_X, 9.12, 343.877166748047);
    effector:SetKey(_TRACK_Y, 9.12, 128.965377807617);
    effector:SetKey(_TRACK_X, 9.28, 366.877166748047);
    effector:SetKey(_TRACK_Y, 9.28, 101.965377807617);
    effector:SetKey(_TRACK_X, 9.44, 378.877166748047);
    effector:SetKey(_TRACK_Y, 9.44, 60.4653778076172);
    effector:SetKey(_TRACK_X, 9.64, 384.877166748047);
    effector:SetKey(_TRACK_Y, 9.64, 19.9653778076172);
    effector:SetKey(_TRACK_X, 9.92, 393.877166748047);
    effector:SetKey(_TRACK_Y, 9.92, -65.0346221923828);
    effector:SetKey(_TRACK_SX, 0, 1);
    effector:SetKey(_TRACK_SY, 0, 1);
    effector:SetKey(_TRACK_SX, 1.6, 0.8);
    effector:SetKey(_TRACK_SY, 1.6, 0.8);
    effector:SetKey(_TRACK_SX, 2.04, 0.7);
    effector:SetKey(_TRACK_SY, 2.04, 0.7);
    effector:SetKey(_TRACK_SX, 2.4, 0.8);
    effector:SetKey(_TRACK_SY, 2.4, 0.8);
    effector:SetKey(_TRACK_SX, 3.92, 0.6);
    effector:SetKey(_TRACK_SY, 3.92, 0.6);
    effector:SetKey(_TRACK_SX, 4.52, 0.7);
    effector:SetKey(_TRACK_SY, 4.52, 0.7);
    effector:SetKey(_TRACK_SX, 5.56, 0.5);
    effector:SetKey(_TRACK_SY, 5.56, 0.5);
    effector:SetKey(_TRACK_SX, 6.16, 0.55);
    effector:SetKey(_TRACK_SY, 6.16, 0.55);
    effector:SetKey(_TRACK_SX, 7.76, 0.65);
    effector:SetKey(_TRACK_SY, 7.76, 0.65);
    effector:SetKey(_TRACK_SX, 8.68, 0.75);
    effector:SetKey(_TRACK_SY, 8.68, 0.75);
    effector:SetKey(_TRACK_SX, 9.92, 1);
    effector:SetKey(_TRACK_SY, 9.92, 1);
    effector:SetKey(_TRACK_A, 0, 0);
    effector:SetKey(_TRACK_A, 0.4, -0.44922036399007);
    effector:SetKey(_TRACK_A, 0.64, -0.76616381002916);
    effector:SetKey(_TRACK_A, 1, -0.19430522181863);
    effector:SetKey(_TRACK_A, 1.4, 0.12804980408124);
    effector:SetKey(_TRACK_A, 1.68, 0.34036411327988);
    effector:SetKey(_TRACK_A, 1.8, 0.05446934590657);
    effector:SetKey(_TRACK_A, 2.6, 0.42544005128995);
    effector:SetKey(_TRACK_A, 2.96, 0.51617871982379);
    effector:SetKey(_TRACK_A, 3.32, 0.4048486867985);
    effector:SetKey(_TRACK_A, 3.64, 0.18938741968794);
    effector:SetKey(_TRACK_A, 3.92, -0.31425618489402);
    effector:SetKey(_TRACK_A, 4.04, -0.0641514547229);
    effector:SetKey(_TRACK_A, 4.6, 0.16787669577721);
    effector:SetKey(_TRACK_A, 4.92, 0.30966375217039);
    effector:SetKey(_TRACK_A, 5.32, 0.10512762594109);
    effector:SetKey(_TRACK_A, 5.56, -0.47113250083059);
    effector:SetKey(_TRACK_A, 5.8, -0.23395792456932);
    effector:SetKey(_TRACK_A, 6.2, -0.50882730947921);
    effector:SetKey(_TRACK_A, 6.56, -0.85017452998554);
    effector:SetKey(_TRACK_A, 7.2, -0.18088379142967);
    effector:SetKey(_TRACK_A, 7.68, 0.09039208269937);
    effector:SetKey(_TRACK_A, 8, -0.00417178062558);
    effector:SetKey(_TRACK_A, 8.44, -0.37047413961855);
    effector:SetKey(_TRACK_A, 8.72, 0.13992367167919);
    effector:SetKey(_TRACK_A, 8.96, -0.1048495101765);
    effector:SetKey(_TRACK_A, 9.44, 0.26194367766668);
    effector:SetKey(_TRACK_A, 9.92, 0.03404039571737);

    effector:Play();

    compositionDragonfly2:Play();

    return compositionDragonfly2;
end

createCompositionEnvTop = function()

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


    -- Layer Layer_1
    local element = auxCreateCompositionElement('data/Texture/Scenes/14_TempleEntrance/Animations/Env/EF_Dust_01.jpg');
    element:SetName('Layer_1');
    compositionEnvTop:AddElement(element);
    element:SetHotSpot(130.5, 131);
    element:SetParentElement(compositionEnvTop);
    element:SetScaleX(1.5);
    element:SetScaleY(1.5);

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

    effector:SetKey(_TRACK_X, 0, 654.056686401367);
    effector:SetKey(_TRACK_Y, 0, 406.647766113281);
    effector:SetKey(_TRACK_X, 9.96, 650.056686401367);
    effector:SetKey(_TRACK_Y, 9.96, 220.647766113281);
    effector:SetKey(_TRACK_A, 0, 0);
    effector:SetKey(_TRACK_A, 9.96, 0.7853981625);
    effector:SetKey(_TRACK_O, 0, 0);
    effector:SetKey(_TRACK_O, 0.92, 0);
    effector:SetKey(_TRACK_O, 2.16, 1);
    effector:SetKey(_TRACK_O, 3.12, 0);
    effector:SetKey(_TRACK_O, 4, 0.8);
    effector:SetKey(_TRACK_O, 4.72, 0);
    effector:SetKey(_TRACK_O, 5.76, 1);
    effector:SetKey(_TRACK_O, 6.56, 0);
    effector:SetKey(_TRACK_O, 7.72, 1);
    effector:SetKey(_TRACK_O, 8.76, 0.8);
    effector:SetKey(_TRACK_O, 9.96, 0);

    effector:Play();


    -- Layer Layer_2
    local element = auxCreateCompositionElement('data/Texture/Scenes/14_TempleEntrance/Animations/Env/EF_Dust_01.jpg');
    element:SetName('Layer_2');
    compositionEnvTop:AddElement(element);
    element:SetHotSpot(130.5, 131);
    element:SetParentElement(compositionEnvTop);
    element:SetScaleX(1.5);
    element:SetScaleY(1.5);

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

    effector:SetKey(_TRACK_X, 0, 357.732788085938);
    effector:SetKey(_TRACK_Y, 0, 383.352233886719);
    effector:SetKey(_TRACK_X, 9.96, 353.732788085938);
    effector:SetKey(_TRACK_Y, 9.96, 197.352233886719);
    effector:SetKey(_TRACK_A, 0, 0);
    effector:SetKey(_TRACK_A, 9.96, -0.7853981625);
    effector:SetKey(_TRACK_O, 0, 0);
    effector:SetKey(_TRACK_O, 1.36, 0.8);
    effector:SetKey(_TRACK_O, 2.16, 0);
    effector:SetKey(_TRACK_O, 3.4, 1);
    effector:SetKey(_TRACK_O, 4.36, 0);
    effector:SetKey(_TRACK_O, 5.24, 0.8);
    effector:SetKey(_TRACK_O, 5.96, 0);
    effector:SetKey(_TRACK_O, 7, 1);
    effector:SetKey(_TRACK_O, 7.8, 0);
    effector:SetKey(_TRACK_O, 8.96, 1);
    effector:SetKey(_TRACK_O, 9.96, 0);

    effector:Play();


    -- Layer Layer_3
    local element = auxCreateCompositionElement('data/Texture/Scenes/14_TempleEntrance/Animations/Env/EF_light4_01.jpg');
    element:SetName('Layer_3');
    compositionEnvTop:AddElement(element);
    element:SetHotSpot(64, 61.5);
    element:SetParentElement(compositionEnvTop);
    element:SetXY(305.465591430664, 294.06477355957);

    element:SetScaleX(11.2195686185218);
    element:SetScaleY(11.1319699567987);
    element:SetAngle(0.30602205842131);

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

    effector:SetKey(_TRACK_O, 0, 0);
    effector:SetKey(_TRACK_O, 0.68, 0.27514284297398);
    effector:SetKey(_TRACK_O, 1.84, 0.08078569030762);
    effector:SetKey(_TRACK_O, 2.72, 0.20000001416888);
    effector:SetKey(_TRACK_O, 3.84, 0.10000001089914);
    effector:SetKey(_TRACK_O, 4.92, 0.4);
    effector:SetKey(_TRACK_O, 5.76, 0.08078569030762);
    effector:SetKey(_TRACK_O, 6.72, 0.2);
    effector:SetKey(_TRACK_O, 7.4, 0.04142854745047);
    effector:SetKey(_TRACK_O, 8.28, 0.31564284951346);
    effector:SetKey(_TRACK_O, 8.96, 0);
    effector:SetKey(_TRACK_O, 9.44, 0.1);
    effector:SetKey(_TRACK_O, 9.96, 0);

    effector:Play();

    compositionEnvTop:Play();

    return compositionEnvTop;
end

