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

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

------------------------------------------------------------------------------
--
function auxPlayAtAbandonedShipAnimation(compositionName)
    local composition = auxGetAtAbandonedShipAnimation(compositionName);
    composition:SetVisible(true);
    composition:Play();
end

------------------------------------------------------------------------------
--
function auxHideAtAbandonedShipAnimation(compositionName)
    local composition = auxGetAtAbandonedShipAnimation(compositionName);
    composition:Stop();
    composition:SetVisible(false);
end

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

    return atAbandonedShipCompositions[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/09_AtAbandonedShip/Animations/') + 1);

	--// set up flies animation
	if (texName == 'Env/Bug_fly[01-02].png') then
		local anim = element:GetTexture();
		anim:Stop();
		anim:SetTextureRect(0,0, 19,18);
		anim:SetFrames(2);
		anim:SetFrame(0);
		anim:SetSpeed(30.0);
		anim:SetMode(HGEANIM_FWD + HGEANIM_LOOP);
		anim:Play();
    end
	--// set up flies animation
	if (texName == 'Env/[01-10].png') then
		local anim = element:GetTexture();
		anim:Stop();
		anim:SetTextureRect(0,0, 53,64);
		anim:SetFrames(10);
		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_Light_01.jpg') then

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

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

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

	--//
    CreateAndRegisterComposition(parent, createCompositionLemur,	'Lemur',	0,0,108.6, 512,384, 10, true);
    CreateAndRegisterComposition(parent, createCompositionFly1,		'Fly1',		0,0,108.5, 512,384, 10, false);
    CreateAndRegisterComposition(parent, createCompositionFly2,		'Fly2',		0,0,108.4, 512,384, 10, false);
    CreateAndRegisterComposition(parent, createCompositionFly3,		'Fly3',		0,0,108.3, 512,384, 10, false);
    CreateAndRegisterComposition(parent, createCompositionSpider,	'Spider',	0,0,108.2, 512,384, 10, false);
    CreateAndRegisterComposition(parent, createCompositionEnvTop,	'EnvTop',	0,0,108.1, 512,384, 10, true);
end

------------------------------------------------------------------------------
--createComposition09_AtAbandonedShip01 = function()
--
--    local composition09_AtAbandonedShip01 = CreateCompositionSequence();
--    local compositionDuration = 10;
--    composition09_AtAbandonedShip01:SetDuration(compositionDuration);
--
--
--    -- Layer Layer_1
--    local element = createCompositionLemur();
--    element:SetName('Layer_1');
--    composition09_AtAbandonedShip01:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(composition09_AtAbandonedShip01);
--    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 = createCompositionFly1();
--    element:SetName('Layer_2');
--    composition09_AtAbandonedShip01:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(composition09_AtAbandonedShip01);
--    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 = createCompositionFly2();
--    element:SetName('Layer_3');
--    composition09_AtAbandonedShip01:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(composition09_AtAbandonedShip01);
--    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 = createCompositionFly3();
--    element:SetName('Layer_4');
--    composition09_AtAbandonedShip01:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(composition09_AtAbandonedShip01);
--    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_5
--    local element = createCompositionSpider();
--    element:SetName('Layer_5');
--    composition09_AtAbandonedShip01:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(composition09_AtAbandonedShip01);
--    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_6
--    local element = createCompositionEnvTop();
--    element:SetName('Layer_6');
--    composition09_AtAbandonedShip01:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(composition09_AtAbandonedShip01);
--    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/09_AtAbandonedShip/Animations/Env/09_AtAbandonedShip01.jpg');
--    element:SetName('BG');
--    composition09_AtAbandonedShip01:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(composition09_AtAbandonedShip01);
--    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();
--
--    composition09_AtAbandonedShip01:Play();
--
--    return composition09_AtAbandonedShip01;
--end

createCompositionEnvTop = function()

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


    -- Layer dust1
    local element = auxCreateCompositionElement('data/Texture/Scenes/09_AtAbandonedShip/Animations/Env/EF_Dust_01.jpg');
    element:SetName('dust1');
    compositionEnvTop:AddElement(element);
    element:SetHotSpot(130.5, 131);
    element:SetParentElement(compositionEnvTop);

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

    effector:SetKey(_TRACK_X, 0, 592.720718383789);
    effector:SetKey(_TRACK_Y, 0, 387.45947265625);
    effector:SetKey(_TRACK_X, 4.68, 584.648651123047);
    effector:SetKey(_TRACK_Y, 4.68, 307.891906738281);
    effector:SetKey(_TRACK_X, 4.88, 322.882873535156);
    effector:SetKey(_TRACK_Y, 4.88, 407.063079833984);
    effector:SetKey(_TRACK_X, 9.96, 336.720718383789);
    effector:SetKey(_TRACK_Y, 9.96, 324.036056518555);
    effector:SetKey(_TRACK_SX, 0, 1.5);
    effector:SetKey(_TRACK_SY, 0, 1.5);
    effector:SetKey(_TRACK_SX, 4.68, 1.4);
    effector:SetKey(_TRACK_SY, 4.68, 1.4);
    effector:SetKey(_TRACK_SX, 4.88, 1.5);
    effector:SetKey(_TRACK_SY, 4.88, 1.5);
    effector:SetKey(_TRACK_SX, 9.96, 1.3);
    effector:SetKey(_TRACK_SY, 9.96, 1.3);
    effector:SetKey(_TRACK_A, 0, 0);
    effector:SetKey(_TRACK_A, 4.68, 0.0872664625);
    effector:SetKey(_TRACK_A, 4.88, 0.34906585);
    effector:SetKey(_TRACK_A, 9.96, -0.0872664625);
    effector:SetKey(_TRACK_O, 0, 0);
    effector:SetKey(_TRACK_O, 0.44, 0.55710234642029);
    effector:SetKey(_TRACK_O, 0.92, 0);
    effector:SetKey(_TRACK_O, 1.4, 0.36431429934885);
    effector:SetKey(_TRACK_O, 2.08, 0.1551113277905);
    effector:SetKey(_TRACK_O, 2.64, 0.51130589888756);
    effector:SetKey(_TRACK_O, 3.4, 0.04911504062077);
    effector:SetKey(_TRACK_O, 3.76, 0.55710234642029);
    effector:SetKey(_TRACK_O, 4.68, 0);
    effector:SetKey(_TRACK_O, 4.88, 0);
    effector:SetKey(_TRACK_O, 5.48, 0.51130589888756);
    effector:SetKey(_TRACK_O, 6.04, 0.22692496478284);
    effector:SetKey(_TRACK_O, 6.8, 0.09999997934892);
    effector:SetKey(_TRACK_O, 7.72, 0.5571023437429);
    effector:SetKey(_TRACK_O, 8.68, 0.1);
    effector:SetKey(_TRACK_O, 9.2, 0.55710234642029);
    effector:SetKey(_TRACK_O, 9.96, 0);

    effector:Play();


    -- Layer light1
    local element = auxCreateCompositionElement('data/Texture/Scenes/09_AtAbandonedShip/Animations/Env/EF_Light_01.jpg');
    element:SetName('light1');
    compositionEnvTop:AddElement(element);
    element:SetHotSpot(149.5, 84.5);
    element:SetParentElement(compositionEnvTop);
    element:SetXY(409.369369506836, 387.45947265625);

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

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

    effector:SetKey(_TRACK_O, 0, 0.2);
    effector:SetKey(_TRACK_O, 0.6, 0.1);
    effector:SetKey(_TRACK_O, 1.33375, 0.4);
    effector:SetKey(_TRACK_O, 2.1844140625, 0.1);
    effector:SetKey(_TRACK_O, 3.156640625, 0.5);
    effector:SetKey(_TRACK_O, 4.128828125, 0.2);
    effector:SetKey(_TRACK_O, 5.1010546875, 0.3);
    effector:SetKey(_TRACK_O, 5.95171875, 0.05);
    effector:SetKey(_TRACK_O, 6.9239453125, 0.2);
    effector:SetKey(_TRACK_O, 8.2607421875, 0.4);
    effector:SetKey(_TRACK_O, 9.11140625, 0.1);
    effector:SetKey(_TRACK_O, 9.96, 0.2);

    effector:Play();

    compositionEnvTop:Play();

    return compositionEnvTop;
end

createCompositionFly1 = function()

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


    -- Layer bug_fly3
    local element = auxCreateCompositionElement('data/Texture/Scenes/09_AtAbandonedShip/Animations/Env/Bug_fly[01-02].png');
    element:SetName('bug_fly3');
    compositionFly1:AddElement(element);
    element:SetHotSpot(9.5, 9);
    element:SetParentElement(compositionFly1);
    element:SetAngle(0);

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

    effector:SetKey(_TRACK_X, 0, 485.565322875977);
    effector:SetKey(_TRACK_Y, 0, 344.186935424805);
    effector:SetKey(_TRACK_X, 0.28, 484.065322875977);
    effector:SetKey(_TRACK_Y, 0.28, 328.686935424805);
    effector:SetKey(_TRACK_X, 0.52, 481.065322875977);
    effector:SetKey(_TRACK_Y, 0.52, 318.186935424805);
    effector:SetKey(_TRACK_X, 0.76, 477.065322875977);
    effector:SetKey(_TRACK_Y, 0.76, 317.936935424805);
    effector:SetKey(_TRACK_X, 1.16, 473.315322875977);
    effector:SetKey(_TRACK_Y, 1.16, 323.186935424805);
    effector:SetKey(_TRACK_X, 1.52, 474.565322875977);
    effector:SetKey(_TRACK_Y, 1.52, 331.936935424805);
    effector:SetKey(_TRACK_X, 1.8, 479.315322875977);
    effector:SetKey(_TRACK_Y, 1.8, 346.936935424805);
    effector:SetKey(_TRACK_X, 2.12, 484.815322875977);
    effector:SetKey(_TRACK_Y, 2.12, 371.186935424805);
    effector:SetKey(_TRACK_X, 2.44, 497.815322875977);
    effector:SetKey(_TRACK_Y, 2.44, 381.686935424805);
    effector:SetKey(_TRACK_X, 2.72, 520.815322875977);
    effector:SetKey(_TRACK_Y, 2.72, 381.936935424805);
    effector:SetKey(_TRACK_X, 3.24, 581.065322875977);
    effector:SetKey(_TRACK_Y, 3.24, 374.436935424805);
    effector:SetKey(_TRACK_X, 3.56, 606.315322875977);
    effector:SetKey(_TRACK_Y, 3.56, 377.186935424805);
    effector:SetKey(_TRACK_X, 3.84, 641.065322875977);
    effector:SetKey(_TRACK_Y, 3.84, 395.186935424805);
    effector:SetKey(_TRACK_X, 4.12, 658.315322875977);
    effector:SetKey(_TRACK_Y, 4.12, 418.936935424805);
    effector:SetKey(_TRACK_X, 4.4, 653.065322875977);
    effector:SetKey(_TRACK_Y, 4.4, 443.686935424805);
    effector:SetKey(_TRACK_X, 4.68, 628.815322875977);
    effector:SetKey(_TRACK_Y, 4.68, 463.186935424805);
    effector:SetKey(_TRACK_X, 4.96, 591.565322875977);
    effector:SetKey(_TRACK_Y, 4.96, 468.186935424805);
    effector:SetKey(_TRACK_X, 5.2, 556.815322875977);
    effector:SetKey(_TRACK_Y, 5.2, 449.436935424805);
    effector:SetKey(_TRACK_X, 5.44, 549.815322875977);
    effector:SetKey(_TRACK_Y, 5.44, 426.436935424805);
    effector:SetKey(_TRACK_X, 5.68, 565.315322875977);
    effector:SetKey(_TRACK_Y, 5.68, 409.436935424805);
    effector:SetKey(_TRACK_X, 5.96, 593.065322875977);
    effector:SetKey(_TRACK_Y, 5.96, 411.686935424805);
    effector:SetKey(_TRACK_X, 6.2, 608.565322875977);
    effector:SetKey(_TRACK_Y, 6.2, 431.686935424805);
    effector:SetKey(_TRACK_X, 6.56, 599.065322875977);
    effector:SetKey(_TRACK_Y, 6.56, 455.186935424805);
    effector:SetKey(_TRACK_X, 6.84, 581.315322875977);
    effector:SetKey(_TRACK_Y, 6.84, 458.436935424805);
    effector:SetKey(_TRACK_X, 7.08, 561.065322875977);
    effector:SetKey(_TRACK_Y, 7.08, 439.936935424805);
    effector:SetKey(_TRACK_X, 7.4, 528.565322875977);
    effector:SetKey(_TRACK_Y, 7.4, 432.436935424805);
    effector:SetKey(_TRACK_X, 7.68, 497.315322875977);
    effector:SetKey(_TRACK_Y, 7.68, 439.936935424805);
    effector:SetKey(_TRACK_X, 7.92, 513.065322875977);
    effector:SetKey(_TRACK_Y, 7.92, 454.936935424805);
    effector:SetKey(_TRACK_X, 8.16, 549.315322875977);
    effector:SetKey(_TRACK_Y, 8.16, 476.936935424805);
    effector:SetKey(_TRACK_X, 8.4, 606.887390136719);
    effector:SetKey(_TRACK_Y, 8.4, 510.058563232422);
    effector:SetKey(_TRACK_X, 8.64, 699.932434082031);
    effector:SetKey(_TRACK_Y, 8.64, 502.619369506836);
    effector:SetKey(_TRACK_X, 8.92, 783.768020629883);
    effector:SetKey(_TRACK_Y, 8.92, 458.981979370117);
    effector:SetKey(_TRACK_X, 9.16, 862.880645751953);
    effector:SetKey(_TRACK_Y, 9.16, 358.756759643555);
    effector:SetKey(_TRACK_X, 9.4, 902.554061889648);
    effector:SetKey(_TRACK_Y, 9.4, 302.389633178711);
    effector:SetKey(_TRACK_X, 9.68, 971.966217041016);
    effector:SetKey(_TRACK_Y, 9.68, 254.734237670898);
    effector:SetKey(_TRACK_X, 9.96, 1109.48649597168);
    effector:SetKey(_TRACK_Y, 9.96, 219.75);
    effector:SetKey(_TRACK_SX, 0, 0.4);
    effector:SetKey(_TRACK_SY, 0, 0.4);
    effector:SetKey(_TRACK_SX, 1.16, 0.5);
    effector:SetKey(_TRACK_SY, 1.16, 0.5);
    effector:SetKey(_TRACK_SX, 2.8, 0.6);
    effector:SetKey(_TRACK_SY, 2.8, 0.6);
    effector:SetKey(_TRACK_SX, 4.44, 0.8);
    effector:SetKey(_TRACK_SY, 4.44, 0.8);
    effector:SetKey(_TRACK_SX, 5.32, 0.8);
    effector:SetKey(_TRACK_SY, 5.32, 0.8);
    effector:SetKey(_TRACK_SX, 6.2, 0.6);
    effector:SetKey(_TRACK_SY, 6.2, 0.6);
    effector:SetKey(_TRACK_SX, 7.08, 0.8);
    effector:SetKey(_TRACK_SY, 7.08, 0.8);
    effector:SetKey(_TRACK_SX, 7.68, 0.9);
    effector:SetKey(_TRACK_SY, 7.68, 0.9);
    effector:SetKey(_TRACK_SX, 8.8, 1.1);
    effector:SetKey(_TRACK_SY, 8.8, 1.1);
    effector:SetKey(_TRACK_SX, 9.96, 1.4);
    effector:SetKey(_TRACK_SY, 9.96, 1.4);
    effector:SetKey(_TRACK_O, 0, 0);
    effector:SetKey(_TRACK_O, 0.08, 0);
    effector:SetKey(_TRACK_O, 0.12, 1);
    effector:SetKey(_TRACK_O, 2.8, 1);
    effector:SetKey(_TRACK_O, 2.84, 0);
    effector:SetKey(_TRACK_O, 3.2, 0);
    effector:SetKey(_TRACK_O, 3.24, 1);
    effector:SetKey(_TRACK_O, 9.96, 1);

    effector:Play();

    compositionFly1:Play();

    return compositionFly1;
end

createCompositionFly2 = function()

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


    -- Layer bug_fly2
    local element = auxCreateCompositionElement('data/Texture/Scenes/09_AtAbandonedShip/Animations/Env/Bug_fly[01-02].png');
    element:SetName('bug_fly2');
    compositionFly2:AddElement(element);
    element:SetHotSpot(9.5, 9);
    element:SetParentElement(compositionFly2);
    element:SetAngle(0);

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

    effector:SetKey(_TRACK_X, 0, 630.894149780273);
    effector:SetKey(_TRACK_Y, 0, 221.173416137695);
    effector:SetKey(_TRACK_X, 0.2, 627.144149780273);
    effector:SetKey(_TRACK_Y, 0.2, 235.423416137695);
    effector:SetKey(_TRACK_X, 0.4, 621.144149780273);
    effector:SetKey(_TRACK_Y, 0.4, 246.173416137695);
    effector:SetKey(_TRACK_X, 0.68, 607.644149780273);
    effector:SetKey(_TRACK_Y, 0.68, 254.923416137695);
    effector:SetKey(_TRACK_X, 0.96, 600.144149780273);
    effector:SetKey(_TRACK_Y, 0.96, 261.923416137695);
    effector:SetKey(_TRACK_X, 1.08, 598.519149780273);
    effector:SetKey(_TRACK_Y, 1.08, 265.423416137695);
    effector:SetKey(_TRACK_X, 1.28, 598.644149780273);
    effector:SetKey(_TRACK_Y, 1.28, 270.423416137695);
    effector:SetKey(_TRACK_X, 1.44, 602.394149780273);
    effector:SetKey(_TRACK_Y, 1.44, 274.048416137695);
    effector:SetKey(_TRACK_X, 1.64, 607.769149780273);
    effector:SetKey(_TRACK_Y, 1.64, 273.923416137695);
    effector:SetKey(_TRACK_X, 1.84, 612.144149780273);
    effector:SetKey(_TRACK_Y, 1.84, 271.798416137695);
    effector:SetKey(_TRACK_X, 1.96, 613.644149780273);
    effector:SetKey(_TRACK_Y, 1.96, 268.423416137695);
    effector:SetKey(_TRACK_X, 2.12, 612.519149780273);
    effector:SetKey(_TRACK_Y, 2.12, 264.548416137695);
    effector:SetKey(_TRACK_X, 2.28, 609.769149780273);
    effector:SetKey(_TRACK_Y, 2.28, 261.923416137695);
    effector:SetKey(_TRACK_X, 2.6, 603.019149780273);
    effector:SetKey(_TRACK_Y, 2.6, 256.298416137695);
    effector:SetKey(_TRACK_X, 2.84, 594.519149780273);
    effector:SetKey(_TRACK_Y, 2.84, 252.798416137695);
    effector:SetKey(_TRACK_X, 3.08, 583.019149780273);
    effector:SetKey(_TRACK_Y, 3.08, 251.798416137695);
    effector:SetKey(_TRACK_X, 3.32, 571.144149780273);
    effector:SetKey(_TRACK_Y, 3.32, 256.548416137695);
    effector:SetKey(_TRACK_X, 3.64, 554.644149780273);
    effector:SetKey(_TRACK_Y, 3.64, 269.798416137695);
    effector:SetKey(_TRACK_X, 3.92, 533.394149780273);
    effector:SetKey(_TRACK_Y, 3.92, 276.798416137695);
    effector:SetKey(_TRACK_X, 4.24, 506.394149780273);
    effector:SetKey(_TRACK_Y, 4.24, 275.298416137695);
    effector:SetKey(_TRACK_X, 4.48, 480.644149780273);
    effector:SetKey(_TRACK_Y, 4.48, 260.048416137695);
    effector:SetKey(_TRACK_X, 4.8, 476.144149780273);
    effector:SetKey(_TRACK_Y, 4.8, 255.048416137695);
    effector:SetKey(_TRACK_X, 5.04, 481.644149780273);
    effector:SetKey(_TRACK_Y, 5.04, 250.298416137695);
    effector:SetKey(_TRACK_X, 5.28, 489.394149780273);
    effector:SetKey(_TRACK_Y, 5.28, 249.548416137695);
    effector:SetKey(_TRACK_X, 5.6, 499.644149780273);
    effector:SetKey(_TRACK_Y, 5.6, 254.548416137695);
    effector:SetKey(_TRACK_X, 6, 494.144149780273);
    effector:SetKey(_TRACK_Y, 6, 259.298416137695);
    effector:SetKey(_TRACK_X, 6.24, 484.894149780273);
    effector:SetKey(_TRACK_Y, 6.24, 262.798416137695);
    effector:SetKey(_TRACK_X, 6.48, 466.394149780273);
    effector:SetKey(_TRACK_Y, 6.48, 260.298416137695);
    effector:SetKey(_TRACK_X, 6.72, 458.644149780273);
    effector:SetKey(_TRACK_Y, 6.72, 255.048416137695);
    effector:SetKey(_TRACK_X, 6.96, 456.894149780273);
    effector:SetKey(_TRACK_Y, 6.96, 249.048416137695);
    effector:SetKey(_TRACK_X, 7.16, 453.394149780273);
    effector:SetKey(_TRACK_Y, 7.16, 254.548416137695);
    effector:SetKey(_TRACK_X, 7.4, 449.144149780273);
    effector:SetKey(_TRACK_Y, 7.4, 272.298416137695);
    effector:SetKey(_TRACK_X, 7.64, 441.144149780273);
    effector:SetKey(_TRACK_Y, 7.64, 278.798416137695);
    effector:SetKey(_TRACK_X, 8.12, 415.144149780273);
    effector:SetKey(_TRACK_Y, 8.12, 274.548416137695);
    effector:SetKey(_TRACK_X, 8.44, 391.894149780273);
    effector:SetKey(_TRACK_Y, 8.44, 275.048416137695);
    effector:SetKey(_TRACK_X, 8.68, 368.144149780273);
    effector:SetKey(_TRACK_Y, 8.68, 277.298416137695);
    effector:SetKey(_TRACK_X, 9, 324.144149780273);
    effector:SetKey(_TRACK_Y, 9, 287.548416137695);
    effector:SetKey(_TRACK_X, 9.24, 290.894149780273);
    effector:SetKey(_TRACK_Y, 9.24, 291.298416137695);
    effector:SetKey(_TRACK_X, 9.48, 261.144149780273);
    effector:SetKey(_TRACK_Y, 9.48, 284.048416137695);
    effector:SetKey(_TRACK_X, 9.76, 241.644149780273);
    effector:SetKey(_TRACK_Y, 9.76, 259.298416137695);
    effector:SetKey(_TRACK_X, 9.96, 231.894149780273);
    effector:SetKey(_TRACK_Y, 9.96, 233.548416137695);
    effector:SetKey(_TRACK_SX, 0, 0.4);
    effector:SetKey(_TRACK_SY, 0, 0.4);
    effector:SetKey(_TRACK_SX, 1.16, 0.6);
    effector:SetKey(_TRACK_SY, 1.16, 0.6);
    effector:SetKey(_TRACK_SX, 2.36, 0.4);
    effector:SetKey(_TRACK_SY, 2.36, 0.4);
    effector:SetKey(_TRACK_SX, 3.12, 0.5);
    effector:SetKey(_TRACK_SY, 3.12, 0.5);
    effector:SetKey(_TRACK_SX, 4, 0.6);
    effector:SetKey(_TRACK_SY, 4, 0.6);
    effector:SetKey(_TRACK_SX, 4.68, 0.7);
    effector:SetKey(_TRACK_SY, 4.68, 0.7);
    effector:SetKey(_TRACK_SX, 5.2, 0.8);
    effector:SetKey(_TRACK_SY, 5.2, 0.8);
    effector:SetKey(_TRACK_SX, 6.24, 0.6);
    effector:SetKey(_TRACK_SY, 6.24, 0.6);
    effector:SetKey(_TRACK_SX, 7, 0.4);
    effector:SetKey(_TRACK_SY, 7, 0.4);
    effector:SetKey(_TRACK_SX, 7.72, 0.8);
    effector:SetKey(_TRACK_SY, 7.72, 0.8);
    effector:SetKey(_TRACK_SX, 9.08, 0.4);
    effector:SetKey(_TRACK_SY, 9.08, 0.4);
    effector:SetKey(_TRACK_O, 0, 0);
    effector:SetKey(_TRACK_O, 0.12, 0);
    effector:SetKey(_TRACK_O, 0.16, 1);
    effector:SetKey(_TRACK_O, 9.08, 1);
    effector:SetKey(_TRACK_O, 9.12, 0);
    effector:SetKey(_TRACK_O, 9.36, 0);
    effector:SetKey(_TRACK_O, 9.4, 1);
    effector:SetKey(_TRACK_O, 9.92, 1);
    effector:SetKey(_TRACK_O, 9.96, 0);

    effector:Play();

    compositionFly2:Play();

    return compositionFly2;
end

createCompositionFly3 = function()

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


    -- Layer bug_fly
    local element = auxCreateCompositionElement('data/Texture/Scenes/09_AtAbandonedShip/Animations/Env/Bug_fly[01-02].png');
    element:SetName('bug_fly');
    compositionFly3:AddElement(element);
    element:SetHotSpot(9.5, 9);
    element:SetParentElement(compositionFly3);

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

    effector:SetKey(_TRACK_X, 0, -36.4864807128906);
    effector:SetKey(_TRACK_Y, 0, 658.540542602539);
    effector:SetKey(_TRACK_X, 0.12, 5.51343482592591);
    effector:SetKey(_TRACK_Y, 0.12, 669.74052908875);
    effector:SetKey(_TRACK_X, 0.2, 38.5135192871094);
    effector:SetKey(_TRACK_Y, 0.2, 670.540542602539);
    effector:SetKey(_TRACK_X, 0.32, 68.2631189498944);
    effector:SetKey(_TRACK_Y, 0.32, 665.790701960071);
    effector:SetKey(_TRACK_X, 0.44, 90.0135192871094);
    effector:SetKey(_TRACK_Y, 0.44, 650.040542602539);
    effector:SetKey(_TRACK_X, 0.64, 93.0135192871094);
    effector:SetKey(_TRACK_Y, 0.64, 617.040542602539);
    effector:SetKey(_TRACK_X, 0.76, 77.0135192871094);
    effector:SetKey(_TRACK_Y, 0.76, 600.540542602539);
    effector:SetKey(_TRACK_X, 0.92, 51.0135192871094);
    effector:SetKey(_TRACK_Y, 0.92, 585.540542602539);
    effector:SetKey(_TRACK_X, 1.04, 40.5135192871094);
    effector:SetKey(_TRACK_Y, 1.04, 576.040542602539);
    effector:SetKey(_TRACK_X, 1.12, 36.0135192871094);
    effector:SetKey(_TRACK_Y, 1.12, 566.040542602539);
    effector:SetKey(_TRACK_X, 1.24, 36.0135192871094);
    effector:SetKey(_TRACK_Y, 1.24, 551.540542602539);
    effector:SetKey(_TRACK_X, 1.36, 39.0135192871094);
    effector:SetKey(_TRACK_Y, 1.36, 529.540542602539);
    effector:SetKey(_TRACK_X, 1.64, 46.5135192871094);
    effector:SetKey(_TRACK_Y, 1.64, 526.540542602539);
    effector:SetKey(_TRACK_X, 2.224140625, 37.0135192871094);
    effector:SetKey(_TRACK_Y, 2.224140625, 528.540542602539);
    effector:SetKey(_TRACK_X, 2.8082421875, 27.0135192871094);
    effector:SetKey(_TRACK_Y, 2.8082421875, 526.040542602539);
    effector:SetKey(_TRACK_X, 3.04, 31.5135192871094);
    effector:SetKey(_TRACK_Y, 3.04, 510.040542602539);
    effector:SetKey(_TRACK_X, 3.24, 35.7635192871094);
    effector:SetKey(_TRACK_Y, 3.24, 486.540542602539);
    effector:SetKey(_TRACK_X, 3.52, 36.2635192871094);
    effector:SetKey(_TRACK_Y, 3.52, 470.540542602539);
    effector:SetKey(_TRACK_X, 3.64, 44.0135192871094);
    effector:SetKey(_TRACK_Y, 3.64, 468.290542602539);
    effector:SetKey(_TRACK_X, 3.76, 52.2635192871094);
    effector:SetKey(_TRACK_Y, 3.76, 467.290542602539);
    effector:SetKey(_TRACK_X, 3.88, 63.2635192871094);
    effector:SetKey(_TRACK_Y, 3.88, 469.040542602539);
    effector:SetKey(_TRACK_X, 4.04, 76.7635192871094);
    effector:SetKey(_TRACK_Y, 4.04, 473.540542602539);
    effector:SetKey(_TRACK_X, 4.2, 90.5135192871094);
    effector:SetKey(_TRACK_Y, 4.2, 482.790542602539);
    effector:SetKey(_TRACK_X, 4.4, 99.7635192871094);
    effector:SetKey(_TRACK_Y, 4.4, 495.790542602539);
    effector:SetKey(_TRACK_X, 4.56, 108.763519287109);
    effector:SetKey(_TRACK_Y, 4.56, 506.790542602539);
    effector:SetKey(_TRACK_X, 4.8, 121.263519287109);
    effector:SetKey(_TRACK_Y, 4.8, 515.040542602539);
    effector:SetKey(_TRACK_X, 5, 131.26356079144);
    effector:SetKey(_TRACK_Y, 5, 515.0717750929);
    effector:SetKey(_TRACK_X, 5.12, 137.263519287109);
    effector:SetKey(_TRACK_Y, 5.12, 508.290542602539);
    effector:SetKey(_TRACK_X, 5.28, 140.513519287109);
    effector:SetKey(_TRACK_Y, 5.28, 496.540542602539);
    effector:SetKey(_TRACK_X, 5.52, 134.513519287109);
    effector:SetKey(_TRACK_Y, 5.52, 474.290542602539);
    effector:SetKey(_TRACK_X, 5.72, 129.763519287109);
    effector:SetKey(_TRACK_Y, 5.72, 444.290542602539);
    effector:SetKey(_TRACK_X, 5.88, 126.763519287109);
    effector:SetKey(_TRACK_Y, 5.88, 413.790542602539);
    effector:SetKey(_TRACK_X, 6.04, 128.513519287109);
    effector:SetKey(_TRACK_Y, 6.04, 401.790542602539);
    effector:SetKey(_TRACK_X, 6.12, 134.013519287109);
    effector:SetKey(_TRACK_Y, 6.12, 398.790542602539);
    effector:SetKey(_TRACK_X, 6.2, 141.513519287109);
    effector:SetKey(_TRACK_Y, 6.2, 400.540542602539);
    effector:SetKey(_TRACK_X, 6.44, 159.263519287109);
    effector:SetKey(_TRACK_Y, 6.44, 401.790542602539);
    effector:SetKey(_TRACK_X, 6.68, 178.263519287109);
    effector:SetKey(_TRACK_Y, 6.68, 401.790542602539);
    effector:SetKey(_TRACK_X, 6.88, 191.763519287109);
    effector:SetKey(_TRACK_Y, 6.88, 401.040542602539);
    effector:SetKey(_TRACK_X, 7.12, 204.513519287109);
    effector:SetKey(_TRACK_Y, 7.12, 391.290542602539);
    effector:SetKey(_TRACK_X, 7.36, 216.013519287109);
    effector:SetKey(_TRACK_Y, 7.36, 388.540542602539);
    effector:SetKey(_TRACK_X, 7.56, 228.263519287109);
    effector:SetKey(_TRACK_Y, 7.56, 389.040542602539);
    effector:SetKey(_TRACK_X, 7.8, 240.263519287109);
    effector:SetKey(_TRACK_Y, 7.8, 379.040542602539);
    effector:SetKey(_TRACK_X, 8, 246.263565928338);
    effector:SetKey(_TRACK_Y, 8, 357.040822449913);
    effector:SetKey(_TRACK_X, 8.2, 234.263519287109);
    effector:SetKey(_TRACK_Y, 8.2, 330.540542602539);
    effector:SetKey(_TRACK_X, 8.4, 206.763519287109);
    effector:SetKey(_TRACK_Y, 8.4, 313.540542602539);
    effector:SetKey(_TRACK_X, 8.64, 177.013519287109);
    effector:SetKey(_TRACK_Y, 8.64, 305.290542602539);
    effector:SetKey(_TRACK_X, 8.76, 157.163765424724);
    effector:SetKey(_TRACK_Y, 8.76, 304.140494963001);
    effector:SetKey(_TRACK_X, 8.84, 146.763519287109);
    effector:SetKey(_TRACK_Y, 8.84, 309.540542602539);
    effector:SetKey(_TRACK_X, 8.96, 137.763604796029);
    effector:SetKey(_TRACK_Y, 8.96, 322.040317169932);
    effector:SetKey(_TRACK_X, 9.08, 135.763519287109);
    effector:SetKey(_TRACK_Y, 9.08, 338.540542602539);
    effector:SetKey(_TRACK_X, 9.2, 148.863490007232);
    effector:SetKey(_TRACK_Y, 9.2, 345.740531904122);
    effector:SetKey(_TRACK_X, 9.28, 161.763519287109);
    effector:SetKey(_TRACK_Y, 9.28, 348.040542602539);
    effector:SetKey(_TRACK_X, 9.44, 180.263519287109);
    effector:SetKey(_TRACK_Y, 9.44, 342.040542602539);
    effector:SetKey(_TRACK_X, 9.6, 189.263519287109);
    effector:SetKey(_TRACK_Y, 9.6, 331.040542602539);
    effector:SetKey(_TRACK_X, 9.72, 193.763519287109);
    effector:SetKey(_TRACK_Y, 9.72, 316.540542602539);
    effector:SetKey(_TRACK_X, 9.84, 181.513694191718);
    effector:SetKey(_TRACK_Y, 9.84, 300.290725280686);
    effector:SetKey(_TRACK_X, 9.96, 165.513519287109);
    effector:SetKey(_TRACK_Y, 9.96, 293.040542602539);
    effector:SetKey(_TRACK_SX, 0, 2);
    effector:SetKey(_TRACK_SY, 0, 2);
    effector:SetKey(_TRACK_SX, 1.36, 1.6);
    effector:SetKey(_TRACK_SY, 1.36, 1.6);
    effector:SetKey(_TRACK_SX, 3.44, 1.6);
    effector:SetKey(_TRACK_SY, 3.44, 1.6);
    effector:SetKey(_TRACK_SX, 5.08, 1.1);
    effector:SetKey(_TRACK_SY, 5.08, 1.1);
    effector:SetKey(_TRACK_SX, 6.04, 1.1);
    effector:SetKey(_TRACK_SY, 6.04, 1.1);
    effector:SetKey(_TRACK_SX, 8.04, 0.9);
    effector:SetKey(_TRACK_SY, 8.04, 0.9);
    effector:SetKey(_TRACK_SX, 8.92, 1.2);
    effector:SetKey(_TRACK_SY, 8.92, 1.2);
    effector:SetKey(_TRACK_SX, 9.96, 0.6);
    effector:SetKey(_TRACK_SY, 9.96, 0.6);
    effector:SetKey(_TRACK_A, 0, 0);
    effector:SetKey(_TRACK_A, 0.52, -0.43443621052572);
    effector:SetKey(_TRACK_A, 1.12, 0.20486978527509);
    effector:SetKey(_TRACK_A, 1.68, -0.66833463851874);
    effector:SetKey(_TRACK_A, 2.92, 0.29645982967212);
    effector:SetKey(_TRACK_A, 3.72, 0.00082929538134);
    effector:SetKey(_TRACK_A, 4.68, 0.68966728718055);
    effector:SetKey(_TRACK_A, 5.2, -0.05136386859049);
    effector:SetKey(_TRACK_A, 6.08, 0.12026988934798);
    effector:SetKey(_TRACK_A, 6.36, 0.67354898878953);
    effector:SetKey(_TRACK_A, 7.04, 0.23381107738874);
    effector:SetKey(_TRACK_A, 8.04, -0.2310113996326);
    effector:SetKey(_TRACK_A, 8.36, -0.52863228426187);
    effector:SetKey(_TRACK_A, 8.8, 0.3740844792816);
    effector:SetKey(_TRACK_A, 9.76, -0.34671048310729);
    effector:SetKey(_TRACK_O, 0, 1);
    effector:SetKey(_TRACK_O, 9.88, 1);
    effector:SetKey(_TRACK_O, 9.96, 0);

    effector:Play();

    compositionFly3:Play();

    return compositionFly3;
end

createCompositionLemur = function()

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


    -- Layer Lemur_eyes
    local element = auxCreateCompositionElement('data/Texture/Scenes/09_AtAbandonedShip/Animations/Env/Lemur_eyes02.png');
    element:SetName('Lemur_eyes');
    compositionLemur:AddElement(element);
    element:SetHotSpot(15, 10);
    compositionLemur:RegisterParentInfo('Lemur_eyes', 'Lemur_head');
    element:SetXY(23.8491058349609, 17.2567596435547);

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

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

    effector:SetKey(_TRACK_O, 0, 0);
    effector:SetKey(_TRACK_O, 0.44, 0);
    effector:SetKey(_TRACK_O, 0.64, 1);
    effector:SetKey(_TRACK_O, 0.96, 0);
    effector:SetKey(_TRACK_O, 3.48, 0);
    effector:SetKey(_TRACK_O, 3.68, 1);
    effector:SetKey(_TRACK_O, 4, 0);
    effector:SetKey(_TRACK_O, 6.88, 0);
    effector:SetKey(_TRACK_O, 7.08, 1);
    effector:SetKey(_TRACK_O, 7.4, 0);
    effector:SetKey(_TRACK_O, 7.56, 0);
    effector:SetKey(_TRACK_O, 7.76, 1);
    effector:SetKey(_TRACK_O, 8.08, 0);

    effector:Play();


    -- Layer Lemur_head
    local element = auxCreateCompositionElement('data/Texture/Scenes/09_AtAbandonedShip/Animations/Env/Lemur_head03.png');
    element:SetName('Lemur_head');
    compositionLemur:AddElement(element);
    element:SetHotSpot(23, 26.5);
    compositionLemur:RegisterParentInfo('Lemur_head', 'Lemur_body');
    element:SetScaleX(1);
    element:SetScaleY(1);
    element:SetOpacity(1);

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

    effector:SetKey(_TRACK_X, 0, 28.6779174804688);
    effector:SetKey(_TRACK_Y, 0, 25.5427856445313);
    effector:SetKey(_TRACK_X, 2.76, 28.6779174804688);
    effector:SetKey(_TRACK_Y, 2.76, 25.5427856445313);
    effector:SetKey(_TRACK_X, 3, 28.3742930781901);
    effector:SetKey(_TRACK_Y, 3, 26.3465027507977);
    effector:SetKey(_TRACK_X, 3.32, 27.6779174804688);
    effector:SetKey(_TRACK_Y, 3.32, 28.2927856445313);
    effector:SetKey(_TRACK_X, 5.36, 27.6779174804688);
    effector:SetKey(_TRACK_Y, 5.36, 28.2927856445313);
    effector:SetKey(_TRACK_X, 5.72, 27.8654174804688);
    effector:SetKey(_TRACK_Y, 5.72, 26.9177856445313);
    effector:SetKey(_TRACK_X, 9.96, 28.6779174804688);
    effector:SetKey(_TRACK_Y, 9.96, 25.5427856445313);
    effector:SetKey(_TRACK_A, 0, 0);
    effector:SetKey(_TRACK_A, 0.36, 0.1034026056501);
    effector:SetKey(_TRACK_A, 1.32, 0.14964303232296);
    effector:SetKey(_TRACK_A, 1.92, 0.14964303031507);
    effector:SetKey(_TRACK_A, 2.2, 0.02220999876739);
    effector:SetKey(_TRACK_A, 2.6, -0.13077233316726);
    effector:SetKey(_TRACK_A, 3.6, -0.1307723313816);
    effector:SetKey(_TRACK_A, 4.12, -0.09886970626227);
    effector:SetKey(_TRACK_A, 4.84, 0.02229358798297);
    effector:SetKey(_TRACK_A, 6.2, 0.02229358798297);
    effector:SetKey(_TRACK_A, 6.64, 0.1746050285042);
    effector:SetKey(_TRACK_A, 8.88, 0.08263801807042);
    effector:SetKey(_TRACK_A, 9.96, 0);

    effector:Play();


    -- Layer Lemur_body
    local element = auxCreateCompositionElement('data/Texture/Scenes/09_AtAbandonedShip/Animations/Env/Lemur_body01.png');
    element:SetName('Lemur_body');
    compositionLemur:AddElement(element);
    element:SetHotSpot(24.5, 43);
    element:SetParentElement(compositionLemur);
    element:SetXY(872.22297668457, 249.950454711914);

    element:SetOpacity(1);

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

    effector:SetKey(_TRACK_SX, 0, 1);
    effector:SetKey(_TRACK_SY, 0, 1);
    effector:SetKey(_TRACK_SX, 0.8, 1);
    effector:SetKey(_TRACK_SY, 0.8, 1.06974346974467);
    effector:SetKey(_TRACK_SX, 2.72, 1);
    effector:SetKey(_TRACK_SY, 2.72, 1.04608284279296);
    effector:SetKey(_TRACK_SX, 3.64, 1);
    effector:SetKey(_TRACK_SY, 3.64, 0.97631547472425);
    effector:SetKey(_TRACK_SX, 4.96, 1);
    effector:SetKey(_TRACK_SY, 4.96, 1.0460661515432);
    effector:SetKey(_TRACK_SX, 6.12, 1);
    effector:SetKey(_TRACK_SY, 6.12, 1.0922399774699);
    effector:SetKey(_TRACK_SX, 7.04, 1);
    effector:SetKey(_TRACK_SY, 7.04, 1.06898926210359);
    effector:SetKey(_TRACK_SX, 9.96, 1);
    effector:SetKey(_TRACK_SY, 9.96, 1);
    effector:SetKey(_TRACK_A, 0, 0);
    effector:SetKey(_TRACK_A, 2, -0.06553815723782);
    effector:SetKey(_TRACK_A, 3.64, 0.00145442909405);
    effector:SetKey(_TRACK_A, 5.52, -0.03184067041519);
    effector:SetKey(_TRACK_A, 9.96, 0);

    effector:Play();

    compositionLemur:Play();

    return compositionLemur;
end

createCompositionSpider = function()

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


    -- Layer Spider1
    local element = auxCreateCompositionElement('data/Texture/Scenes/09_AtAbandonedShip/Animations/Env/[01-10].png');
    element:SetName('Spider1');
    compositionSpider:AddElement(element);
    element:SetHotSpot(23, 44);
    element:SetParentElement(compositionSpider);
    element:SetOpacity(1);

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

    effector:SetKey(_TRACK_X, 0, 898.306304931641);
    effector:SetKey(_TRACK_Y, 0, -43.8198089599609);
    effector:SetKey(_TRACK_X, 0.12, 878.702697753906);
    effector:SetKey(_TRACK_Y, 0.12, 34.5946044921875);
    effector:SetKey(_TRACK_X, 0.2, 851.02702331543);
    effector:SetKey(_TRACK_Y, 0.2, 42.6666717529297);
    effector:SetKey(_TRACK_X, 0.32, 823.02702331543);
    effector:SetKey(_TRACK_Y, 0.32, 54.6666717529297);
    effector:SetKey(_TRACK_X, 0.4, 811.52702331543);
    effector:SetKey(_TRACK_Y, 0.4, 66.1666717529297);
    effector:SetKey(_TRACK_X, 0.48, 806.52702331543);
    effector:SetKey(_TRACK_Y, 0.48, 76.6666717529297);
    effector:SetKey(_TRACK_X, 0.56, 794.02702331543);
    effector:SetKey(_TRACK_Y, 0.56, 80.6666717529297);
    effector:SetKey(_TRACK_X, 0.64, 774.02702331543);
    effector:SetKey(_TRACK_Y, 0.64, 79.6666717529297);
    effector:SetKey(_TRACK_X, 0.76, 753.52702331543);
    effector:SetKey(_TRACK_Y, 0.76, 81.1666717529297);
    effector:SetKey(_TRACK_X, 0.88, 743.52702331543);
    effector:SetKey(_TRACK_Y, 0.88, 76.1666717529297);
    effector:SetKey(_TRACK_X, 0.96, 735.02702331543);
    effector:SetKey(_TRACK_Y, 0.96, 83.6666717529297);
    effector:SetKey(_TRACK_X, 1.04, 726.02702331543);
    effector:SetKey(_TRACK_Y, 1.04, 78.1666717529297);
    effector:SetKey(_TRACK_X, 1.12, 714.02702331543);
    effector:SetKey(_TRACK_Y, 1.12, 70.6666717529297);
    effector:SetKey(_TRACK_X, 1.2, 702.02702331543);
    effector:SetKey(_TRACK_Y, 1.2, 57.6666717529297);
    effector:SetKey(_TRACK_X, 1.28, 701.52702331543);
    effector:SetKey(_TRACK_Y, 1.28, 44.6666717529297);
    effector:SetKey(_TRACK_X, 1.36, 682.52702331543);
    effector:SetKey(_TRACK_Y, 1.36, 38.6666717529297);
    effector:SetKey(_TRACK_X, 1.44, 662.52702331543);
    effector:SetKey(_TRACK_Y, 1.44, 42.6666717529297);
    effector:SetKey(_TRACK_X, 1.56, 636.52702331543);
    effector:SetKey(_TRACK_Y, 1.56, 53.6666717529297);
    effector:SetKey(_TRACK_X, 1.72, 622.02702331543);
    effector:SetKey(_TRACK_Y, 1.72, 72.1666717529297);
    effector:SetKey(_TRACK_X, 1.84, 605.52702331543);
    effector:SetKey(_TRACK_Y, 1.84, 84.6666717529297);
    effector:SetKey(_TRACK_X, 1.96, 594.52702331543);
    effector:SetKey(_TRACK_Y, 1.96, 95.1666717529297);
    effector:SetKey(_TRACK_X, 2.08, 584.02702331543);
    effector:SetKey(_TRACK_Y, 2.08, 107.66667175293);
    effector:SetKey(_TRACK_X, 2.24, 572.02702331543);
    effector:SetKey(_TRACK_Y, 2.24, 113.66667175293);
    effector:SetKey(_TRACK_X, 2.4, 564.02702331543);
    effector:SetKey(_TRACK_Y, 2.4, 121.16667175293);
    effector:SetKey(_TRACK_X, 2.52, 553.02702331543);
    effector:SetKey(_TRACK_Y, 2.52, 124.66667175293);
    effector:SetKey(_TRACK_X, 2.68, 538.52702331543);
    effector:SetKey(_TRACK_Y, 2.68, 124.66667175293);
    effector:SetKey(_TRACK_X, 2.84, 526.02702331543);
    effector:SetKey(_TRACK_Y, 2.84, 121.66667175293);
    effector:SetKey(_TRACK_X, 3.04, 513.02702331543);
    effector:SetKey(_TRACK_Y, 3.04, 115.66667175293);
    effector:SetKey(_TRACK_X, 3.16, 502.02702331543);
    effector:SetKey(_TRACK_Y, 3.16, 104.66667175293);
    effector:SetKey(_TRACK_X, 3.28, 493.02702331543);
    effector:SetKey(_TRACK_Y, 3.28, 91.6666717529297);
    effector:SetKey(_TRACK_X, 3.4, 494.02702331543);
    effector:SetKey(_TRACK_Y, 3.4, 72.6666717529297);
    effector:SetKey(_TRACK_X, 3.48, 505.52702331543);
    effector:SetKey(_TRACK_Y, 3.48, 60.1666717529297);
    effector:SetKey(_TRACK_X, 3.64, 539.02702331543);
    effector:SetKey(_TRACK_Y, 3.64, 56.6666717529297);
    effector:SetKey(_TRACK_X, 3.8, 567.02702331543);
    effector:SetKey(_TRACK_Y, 3.8, 64.6666717529297);
    effector:SetKey(_TRACK_X, 3.96, 578.52702331543);
    effector:SetKey(_TRACK_Y, 3.96, 81.6666717529297);
    effector:SetKey(_TRACK_X, 4.12, 576.02702331543);
    effector:SetKey(_TRACK_Y, 4.12, 96.1666717529297);
    effector:SetKey(_TRACK_X, 4.28, 569.02702331543);
    effector:SetKey(_TRACK_Y, 4.28, 103.16667175293);
    effector:SetKey(_TRACK_X, 4.44, 560.02702331543);
    effector:SetKey(_TRACK_Y, 4.44, 109.16667175293);
    effector:SetKey(_TRACK_X, 4.6, 551.52702331543);
    effector:SetKey(_TRACK_Y, 4.6, 116.66667175293);
    effector:SetKey(_TRACK_X, 4.76, 544.52702331543);
    effector:SetKey(_TRACK_Y, 4.76, 122.16667175293);
    effector:SetKey(_TRACK_X, 4.92, 531.52702331543);
    effector:SetKey(_TRACK_Y, 4.92, 125.66667175293);
    effector:SetKey(_TRACK_X, 5.08, 518.52702331543);
    effector:SetKey(_TRACK_Y, 5.08, 126.16667175293);
    effector:SetKey(_TRACK_X, 5.24, 504.02702331543);
    effector:SetKey(_TRACK_Y, 5.24, 124.66667175293);
    effector:SetKey(_TRACK_X, 5.4, 487.02702331543);
    effector:SetKey(_TRACK_Y, 5.4, 118.66667175293);
    effector:SetKey(_TRACK_X, 5.56, 469.52702331543);
    effector:SetKey(_TRACK_Y, 5.56, 106.16667175293);
    effector:SetKey(_TRACK_X, 5.72, 446.02702331543);
    effector:SetKey(_TRACK_Y, 5.72, 91.1666717529297);
    effector:SetKey(_TRACK_X, 5.88, 421.02702331543);
    effector:SetKey(_TRACK_Y, 5.88, 83.1666717529297);
    effector:SetKey(_TRACK_X, 6.04, 394.52702331543);
    effector:SetKey(_TRACK_Y, 6.04, 78.6666717529297);
    effector:SetKey(_TRACK_X, 6.2, 371.02702331543);
    effector:SetKey(_TRACK_Y, 6.2, 79.1666717529297);
    effector:SetKey(_TRACK_X, 6.28, 369.02702331543);
    effector:SetKey(_TRACK_Y, 6.28, 85.1666717529297);
    effector:SetKey(_TRACK_X, 6.44, 344.52702331543);
    effector:SetKey(_TRACK_Y, 6.44, 86.6666717529297);
    effector:SetKey(_TRACK_X, 6.56, 323.52702331543);
    effector:SetKey(_TRACK_Y, 6.56, 83.6666717529297);
    effector:SetKey(_TRACK_X, 6.68, 312.02702331543);
    effector:SetKey(_TRACK_Y, 6.68, 80.1666717529297);
    effector:SetKey(_TRACK_X, 6.84, 286.52702331543);
    effector:SetKey(_TRACK_Y, 6.84, 87.1666717529297);
    effector:SetKey(_TRACK_X, 7, 264.52702331543);
    effector:SetKey(_TRACK_Y, 7, 97.6666717529297);
    effector:SetKey(_TRACK_X, 7.16, 251.52702331543);
    effector:SetKey(_TRACK_Y, 7.16, 109.66667175293);
    effector:SetKey(_TRACK_X, 7.32, 236.02702331543);
    effector:SetKey(_TRACK_Y, 7.32, 115.66667175293);
    effector:SetKey(_TRACK_X, 7.48, 221.02702331543);
    effector:SetKey(_TRACK_Y, 7.48, 119.16667175293);
    effector:SetKey(_TRACK_X, 7.64, 202.02702331543);
    effector:SetKey(_TRACK_Y, 7.64, 117.16667175293);
    effector:SetKey(_TRACK_X, 7.8, 179.02702331543);
    effector:SetKey(_TRACK_Y, 7.8, 108.66667175293);
    effector:SetKey(_TRACK_X, 7.96, 153.02702331543);
    effector:SetKey(_TRACK_Y, 7.96, 87.1666717529297);
    effector:SetKey(_TRACK_X, 8.12, 113.52702331543);
    effector:SetKey(_TRACK_Y, 8.12, 70.1666717529297);
    effector:SetKey(_TRACK_X, 8.28, 95.0270233154297);
    effector:SetKey(_TRACK_Y, 8.28, 42.1666717529297);
    effector:SetKey(_TRACK_X, 8.44, 78.0270233154297);
    effector:SetKey(_TRACK_Y, 8.44, 7.16667175292969);
    effector:SetKey(_TRACK_X, 8.6, 56.0270233154297);
    effector:SetKey(_TRACK_Y, 8.6, -46.3333282470703);
    effector:SetKey(_TRACK_SX, 0, 1.2);
    effector:SetKey(_TRACK_SY, 0, 1.2);
    effector:SetKey(_TRACK_SX, 0.72, 0.8);
    effector:SetKey(_TRACK_SY, 0.72, 0.8);
    effector:SetKey(_TRACK_SX, 1.28, 1);
    effector:SetKey(_TRACK_SY, 1.28, 1);
    effector:SetKey(_TRACK_SX, 2.68, 0.5);
    effector:SetKey(_TRACK_SY, 2.68, 0.5);
    effector:SetKey(_TRACK_SX, 3.64, 0.8);
    effector:SetKey(_TRACK_SY, 3.64, 0.8);
    effector:SetKey(_TRACK_SX, 4.92, 0.5);
    effector:SetKey(_TRACK_SY, 4.92, 0.5);
    effector:SetKey(_TRACK_SX, 6.04, 0.7);
    effector:SetKey(_TRACK_SY, 6.04, 0.7);
    effector:SetKey(_TRACK_SX, 6.64, 0.8);
    effector:SetKey(_TRACK_SY, 6.64, 0.8);
    effector:SetKey(_TRACK_SX, 7.48, 0.5);
    effector:SetKey(_TRACK_SY, 7.48, 0.5);
    effector:SetKey(_TRACK_SX, 8.6, 1.2);
    effector:SetKey(_TRACK_SY, 8.6, 1.2);
    effector:SetKey(_TRACK_A, 0, -3.1518893855729);
    effector:SetKey(_TRACK_A, 0.8, -3.1518893855729);
    effector:SetKey(_TRACK_A, 0.88, -3.80553159646154);
    effector:SetKey(_TRACK_A, 0.96, -2.99388441988898);
    effector:SetKey(_TRACK_A, 1.16, -2.68828864796944);
    effector:SetKey(_TRACK_A, 1.2, -2.22177628460752);
    effector:SetKey(_TRACK_A, 1.28, -2.36723719101357);
    effector:SetKey(_TRACK_A, 1.36, -3.0911494469607);
    effector:SetKey(_TRACK_A, 1.68, -3.86448486885881);
    effector:SetKey(_TRACK_A, 2.68, -3.15202979719174);
    effector:SetKey(_TRACK_A, 3.28, -2.88438220762284);
    effector:SetKey(_TRACK_A, 3.88, -3.45146079876201);
    effector:SetKey(_TRACK_A, 5.12, -3.27443416873843);
    effector:SetKey(_TRACK_A, 5.8, -3.02984891498374);
    effector:SetKey(_TRACK_A, 6.2, -3.18516608311892);
    effector:SetKey(_TRACK_A, 6.28, -4.14385210295523);
    effector:SetKey(_TRACK_A, 6.32, -3.2683197895552);
    effector:SetKey(_TRACK_A, 6.6, -3.13012091118001);
    effector:SetKey(_TRACK_A, 6.8, -3.32187953237982);
    effector:SetKey(_TRACK_A, 7.56, -3.26738777987525);
    effector:SetKey(_TRACK_A, 7.84, -2.73179162924697);

    effector:Play();

    compositionSpider:Play();

    return compositionSpider;
end

