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

--// 1.	rename:					" -> '
--// 2. comment root composition with texture "createCompositionRootComposition = function()"
--// 3. add auxiliaru routines for managing animations: 
--		auxPlayVolcanoMonsterAnimation(), 
--		auxGetVolcanoMonsterAnimation(), 
--		auxCreateVolcanoMonsterAnimations()
--// 4. replace CreateCompositionElement() with auxCreateCompositionElement() for some corrections ...

------------------------------------------------------------------------------
--
function auxPlayVolcanoMonsterAnimation(compositionName)
    local composition = auxGetVolcanoMonsterAnimation(compositionName);
    composition:SetVisible(true);
    composition:Play();
end

------------------------------------------------------------------------------
--
function auxHideVolcanoMonsterAnimation(compositionName)
    local composition = auxGetVolcanoMonsterAnimation(compositionName);
    composition:Stop();
    composition:SetVisible(false);
end

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

    return volcanoMonsterCompositions[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 auxCreateCompositionElement2(resourceName)
	local element = CreateCompositionElement(resourceName);
    local texName = string.sub(resourceName, string.len('data/Texture/Scenes/21_Volcano/Animations/Monster/') + 1);


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

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

------------------------------------------------------------------------------
--
function auxCreateVolcanoMonsterAnimations(parent)
    assert(parent ~= nil);
    volcanoMonsterCompositions = {};
    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);
        volcanoMonsterCompositions[element:GetName()] = element;
    end
    
    CreateAndRegisterComposition(parent, createCompositionLayerOver, 	'LayerOver',	0,0,101.6, 515,-163, 10, true);
    CreateAndRegisterComposition(parent, createCompositionMonstr_Idle2, 'MonsterIdle2',	0,0,101.5, 512,384, 6.5, false);
    CreateAndRegisterComposition(parent, createCompositionMonstr_Idle1, 'MonsterIdle1',	0,0,101.4, 512,384, 10, true);
end

------------------------------------------------------------------------------
--
--createCompositionRootComposition = function()
--
--    local compositionRootComposition = CreateCompositionSequence();
--    local compositionDuration = 10;
--    compositionRootComposition:SetDuration(compositionDuration);
--
--
--    -- Layer Layer_1
--    local element = createCompositionLayerOver();
--    element:SetName('Layer_1');
--    compositionRootComposition:AddElement(element);
--    element:SetHotSpot(462, 112);
--    element:SetParentElement(compositionRootComposition);
--    element:SetXY(459.202697753906, 659.013519287109);
--
--    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 = createCompositionMonstr_Idle2();
--    element:SetName('Layer_2');
--    compositionRootComposition:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(compositionRootComposition);
--    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 = createCompositionMonstr_Idle1();
--    element:SetName('Layer_3');
--    compositionRootComposition:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(compositionRootComposition);
--    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 = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/fon5_back.jpg');
--    element:SetName('Layer_4');
--    compositionRootComposition:AddElement(element);
--    element:SetHotSpot(512, 384);
--    element:SetParentElement(compositionRootComposition);
--    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();
--
--    compositionRootComposition:Play();
--
--    return compositionRootComposition;
--end

createCompositionLayerOver = function()

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


    -- Layer Layer_1
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/Layer_Monstro03.png');
    element:SetName('Layer_1');
    compositionLayerOver:AddElement(element);
    element:SetHotSpot(462, 112);
    element:SetParentElement(compositionLayerOver);
    element:SetXY(462, 112);

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

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


    effector:Play();

    compositionLayerOver:Play();

    return compositionLayerOver;
end

createCompositionMonstr_Idle1 = function()

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


    -- Layer Layer_1
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/EF_blik01.jpg');
    element:SetName('Layer_1');
    compositionMonstr_Idle1:AddElement(element);
    element:SetHotSpot(35.5, 13.5);
    element:SetParentElement(compositionMonstr_Idle1);
    element:SetAngle(0.16384812677468);

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

    effector:SetKey(_TRACK_X, 0, 325);
    effector:SetKey(_TRACK_Y, 0, 676);
    effector:SetKey(_TRACK_X, 0.5984375, 325);
    effector:SetKey(_TRACK_Y, 0.5984375, 632.363770381018);
    effector:SetKey(_TRACK_X, 1.462890625, 325);
    effector:SetKey(_TRACK_Y, 1.462890625, 596);
    effector:SetKey(_TRACK_X, 4.5616015625, 324);
    effector:SetKey(_TRACK_Y, 4.5616015625, 682);
    effector:SetKey(_TRACK_X, 4.88, 456);
    effector:SetKey(_TRACK_Y, 4.88, 704);
    effector:SetKey(_TRACK_X, 5.4784375, 456);
    effector:SetKey(_TRACK_Y, 5.4784375, 660.363770381018);
    effector:SetKey(_TRACK_X, 6.342890625, 456);
    effector:SetKey(_TRACK_Y, 6.342890625, 624);
    effector:SetKey(_TRACK_X, 9.4016015625, 456);
    effector:SetKey(_TRACK_Y, 9.4016015625, 704);
    effector:SetKey(_TRACK_SX, 0, 1);
    effector:SetKey(_TRACK_SY, 0, 1);
    effector:SetKey(_TRACK_SX, 0.88, 1.5);
    effector:SetKey(_TRACK_SY, 0.88, 1.5);
    effector:SetKey(_TRACK_SX, 1.84, 1.2);
    effector:SetKey(_TRACK_SY, 1.84, 1.2);
    effector:SetKey(_TRACK_SX, 2.72, 1.5);
    effector:SetKey(_TRACK_SY, 2.72, 1.5);
    effector:SetKey(_TRACK_SX, 3.64, 1);
    effector:SetKey(_TRACK_SY, 3.64, 1);
    effector:SetKey(_TRACK_SX, 4.88, 0.8);
    effector:SetKey(_TRACK_SY, 4.88, 0.8);
    effector:SetKey(_TRACK_SX, 5.52, 1.07746478873239);
    effector:SetKey(_TRACK_SY, 5.52, 1.5);
    effector:SetKey(_TRACK_SX, 5.88, 1.2);
    effector:SetKey(_TRACK_SY, 5.88, 1.2);
    effector:SetKey(_TRACK_SX, 6.36, 1.4);
    effector:SetKey(_TRACK_SY, 6.36, 1.4);
    effector:SetKey(_TRACK_SX, 6.96, 1);
    effector:SetKey(_TRACK_SY, 6.96, 1);
    effector:SetKey(_TRACK_SX, 7.68, 1.4);
    effector:SetKey(_TRACK_SY, 7.68, 1.4);
    effector:SetKey(_TRACK_SX, 8.56, 1);
    effector:SetKey(_TRACK_SY, 8.56, 1);
    effector:SetKey(_TRACK_O, 0, 1);
    effector:SetKey(_TRACK_O, 0.56, 0.6);
    effector:SetKey(_TRACK_O, 1.44, 0.91689552421);
    effector:SetKey(_TRACK_O, 2.32, 0.60000001579019);
    effector:SetKey(_TRACK_O, 3.12, 0.97460696699607);
    effector:SetKey(_TRACK_O, 4.08, 0.66610945273632);
    effector:SetKey(_TRACK_O, 5.04, 1);
    effector:SetKey(_TRACK_O, 6.04, 0.50682587064677);
    effector:SetKey(_TRACK_O, 6.72, 1);
    effector:SetKey(_TRACK_O, 7.56, 0.6);
    effector:SetKey(_TRACK_O, 8.44, 0.8);

    effector:Play();


    -- Layer Layer_2
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/EF_blik01.jpg');
    element:SetName('Layer_2');
    compositionMonstr_Idle1:AddElement(element);
    element:SetHotSpot(35.5, 13.5);
    element:SetParentElement(compositionMonstr_Idle1);
    element:SetAngle(-0.15019665987072);

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

    effector:SetKey(_TRACK_X, 6.04, 772);
    effector:SetKey(_TRACK_Y, 6.04, 670);
    effector:SetKey(_TRACK_X, 6.6384375, 772);
    effector:SetKey(_TRACK_Y, 6.6384375, 626.363770381018);
    effector:SetKey(_TRACK_X, 7.502890625, 772);
    effector:SetKey(_TRACK_Y, 7.502890625, 590);
    effector:SetKey(_TRACK_X, 9.9616015625, 772);
    effector:SetKey(_TRACK_Y, 9.9616015625, 670);
    effector:SetKey(_TRACK_SX, 6.04, 1);
    effector:SetKey(_TRACK_SY, 6.04, 1);
    effector:SetKey(_TRACK_SX, 6.72, 1.5);
    effector:SetKey(_TRACK_SY, 6.72, 1.5);
    effector:SetKey(_TRACK_SX, 7.36, 1.2);
    effector:SetKey(_TRACK_SY, 7.36, 1.2);
    effector:SetKey(_TRACK_SX, 8.16, 1.4);
    effector:SetKey(_TRACK_SY, 8.16, 1.4);
    effector:SetKey(_TRACK_SX, 9.12, 1);
    effector:SetKey(_TRACK_SY, 9.12, 1);
    effector:SetKey(_TRACK_SX, 9.68, 1.2);
    effector:SetKey(_TRACK_SY, 9.68, 1.2);
    effector:SetKey(_TRACK_O, 6.04, 0.6);
    effector:SetKey(_TRACK_O, 6.56, 1);
    effector:SetKey(_TRACK_O, 7.28, 0.6);
    effector:SetKey(_TRACK_O, 8.28, 1);
    effector:SetKey(_TRACK_O, 9.12, 0.6);
    effector:SetKey(_TRACK_O, 9.92, 1);

    effector:Play();


    -- Layer Layer_3
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/Mons_ring01.png');
    element:SetName('Layer_3');
    compositionMonstr_Idle1:AddElement(element);
    element:SetHotSpot(112, 112);
    element:SetParentElement(compositionMonstr_Idle1);
    element:SetOpacity(1);

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

    effector:SetKey(_TRACK_X, 6.0383984375, 788);
    effector:SetKey(_TRACK_Y, 6.0383984375, 764);
    effector:SetKey(_TRACK_X, 6.6368359375, 788);
    effector:SetKey(_TRACK_Y, 6.6368359375, 720.363770381018);
    effector:SetKey(_TRACK_X, 7.5012890625, 788);
    effector:SetKey(_TRACK_Y, 7.5012890625, 684);
    effector:SetKey(_TRACK_X, 9.96, 788);
    effector:SetKey(_TRACK_Y, 9.96, 764);
    effector:SetKey(_TRACK_SX, 6.0383984375, 1);
    effector:SetKey(_TRACK_SY, 6.0383984375, 1);
    effector:SetKey(_TRACK_SX, 9.96, 1);
    effector:SetKey(_TRACK_SY, 9.96, 1);
    effector:SetKey(_TRACK_A, 6.0383984375, 4.71566228572777);
    effector:SetKey(_TRACK_A, 9.96, 7.85463963023383);

    effector:Play();


    -- Layer Layer_4
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/Mons_ring01.png');
    element:SetName('Layer_4');
    compositionMonstr_Idle1:AddElement(element);
    element:SetHotSpot(112, 112);
    element:SetParentElement(compositionMonstr_Idle1);
    element:SetOpacity(1);

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

    effector:SetKey(_TRACK_X, 0, 316);
    effector:SetKey(_TRACK_Y, 0, 768);
    effector:SetKey(_TRACK_X, 0.5984375, 316);
    effector:SetKey(_TRACK_Y, 0.5984375, 724.363770381018);
    effector:SetKey(_TRACK_X, 1.462890625, 316);
    effector:SetKey(_TRACK_Y, 1.462890625, 688);
    effector:SetKey(_TRACK_X, 4.5616015625, 316);
    effector:SetKey(_TRACK_Y, 4.5616015625, 768);
    effector:SetKey(_TRACK_X, 4.88, 442);
    effector:SetKey(_TRACK_Y, 4.88, 751);
    effector:SetKey(_TRACK_X, 5.4784375, 442);
    effector:SetKey(_TRACK_Y, 5.4784375, 707.363770381018);
    effector:SetKey(_TRACK_X, 6.342890625, 442);
    effector:SetKey(_TRACK_Y, 6.342890625, 671);
    effector:SetKey(_TRACK_X, 9.4016015625, 442);
    effector:SetKey(_TRACK_Y, 9.4016015625, 751);
    effector:SetKey(_TRACK_SX, 0, 1);
    effector:SetKey(_TRACK_SY, 0, 1);
    effector:SetKey(_TRACK_SX, 4.56, 1);
    effector:SetKey(_TRACK_SY, 4.56, 1);
    effector:SetKey(_TRACK_SX, 4.88, 0.6);
    effector:SetKey(_TRACK_SY, 4.88, 0.6);
    effector:SetKey(_TRACK_SX, 9.4, 0.6);
    effector:SetKey(_TRACK_SY, 9.4, 0.6);
    effector:SetKey(_TRACK_A, 0, 4.71566228572777);
    effector:SetKey(_TRACK_A, 4.5616015625, 7.85463963023383);
    effector:SetKey(_TRACK_A, 4.88, 4.71566228572777);
    effector:SetKey(_TRACK_A, 9.4016015625, 7.85463963023383);

    effector:Play();


    -- Layer Layer_5
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/EF_blik01.jpg');
    element:SetName('Layer_5');
    compositionMonstr_Idle1:AddElement(element);
    element:SetHotSpot(35.5, 13.5);
    element:SetParentElement(compositionMonstr_Idle1);
    element:SetAngle(0.37083768836752);

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

    effector:SetKey(_TRACK_X, 0.68, 429);
    effector:SetKey(_TRACK_Y, 0.68, 704);
    effector:SetKey(_TRACK_X, 1.2623828125, 429);
    effector:SetKey(_TRACK_Y, 1.2623828125, 660.363770381018);
    effector:SetKey(_TRACK_X, 2.10359375, 429);
    effector:SetKey(_TRACK_Y, 2.10359375, 624);
    effector:SetKey(_TRACK_X, 5.08015625, 429);
    effector:SetKey(_TRACK_Y, 5.08015625, 704);
    effector:SetKey(_TRACK_SX, 0.68, 1);
    effector:SetKey(_TRACK_SY, 0.68, 1);
    effector:SetKey(_TRACK_SX, 2.2, 1.4);
    effector:SetKey(_TRACK_SY, 2.2, 1.4);
    effector:SetKey(_TRACK_SX, 2.96, 1.2);
    effector:SetKey(_TRACK_SY, 2.96, 1.2);
    effector:SetKey(_TRACK_SX, 3.8, 1.6);
    effector:SetKey(_TRACK_SY, 3.8, 1.6);
    effector:SetKey(_TRACK_SX, 4.88, 1);
    effector:SetKey(_TRACK_SY, 4.88, 1);
    effector:SetKey(_TRACK_O, 0.68, 0.8);
    effector:SetKey(_TRACK_O, 1.24, 1);
    effector:SetKey(_TRACK_O, 1.68, 0.8);
    effector:SetKey(_TRACK_O, 2.2, 1);
    effector:SetKey(_TRACK_O, 2.76, 0.6);
    effector:SetKey(_TRACK_O, 3.48, 1);
    effector:SetKey(_TRACK_O, 4.2, 0.6);
    effector:SetKey(_TRACK_O, 4.92, 0.8);

    effector:Play();


    -- Layer Layer_6
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/Mons_ring01.png');
    element:SetName('Layer_6');
    compositionMonstr_Idle1:AddElement(element);
    element:SetHotSpot(112, 112);
    element:SetParentElement(compositionMonstr_Idle1);
    element:SetScaleX(1);
    element:SetScaleY(1);
    element:SetOpacity(1);

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

    effector:SetKey(_TRACK_X, 0.67984375, 392);
    effector:SetKey(_TRACK_Y, 0.67984375, 791);
    effector:SetKey(_TRACK_X, 1.2622265625, 392);
    effector:SetKey(_TRACK_Y, 1.2622265625, 747.363770381018);
    effector:SetKey(_TRACK_X, 2.1034375, 392);
    effector:SetKey(_TRACK_Y, 2.1034375, 711);
    effector:SetKey(_TRACK_X, 5.08, 392);
    effector:SetKey(_TRACK_Y, 5.08, 791);
    effector:SetKey(_TRACK_A, 0.67984375, 4.71566228572777);
    effector:SetKey(_TRACK_A, 5.08, 9.46606347961913);

    effector:Play();

    compositionMonstr_Idle1:Play();

    return compositionMonstr_Idle1;
end

createCompositionMonstr_Idle2 = function()

    local compositionMonstr_Idle2 = CreateCompositionSequence();
    local compositionDuration = 6.5;
    compositionMonstr_Idle2:SetDuration(compositionDuration);


    -- Layer Layer_1
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/Water_splash01.png');
    element:SetName('Layer_1');
    compositionMonstr_Idle2:AddElement(element);
    element:SetHotSpot(58, 72.5);
    element:SetParentElement(compositionMonstr_Idle2);
    element:SetXY(374.297302246094, 708.540542602539);

    element:SetAngle(0);

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

    effector:SetKey(_TRACK_SX, 0.12, -0.05649131274131);
    effector:SetKey(_TRACK_SY, 0.12, 0.55686904187111);
    effector:SetKey(_TRACK_SX, 0.2, 0.84350868725869);
    effector:SetKey(_TRACK_SY, 0.2, 3.74307593842285);
    effector:SetKey(_TRACK_SX, 0.28, 1.68636583011584);
    effector:SetKey(_TRACK_SY, 0.28, 4.63962766256078);
    effector:SetKey(_TRACK_SX, 0.4, 2.67208011583012);
    effector:SetKey(_TRACK_SY, 0.4, 5.17755869704354);
    effector:SetKey(_TRACK_SX, 0.56, 3.61570945945947);
    effector:SetKey(_TRACK_SY, 0.56, 4.6810069729056);
    effector:SetKey(_TRACK_SX, 0.72, 3.96821911196912);
    effector:SetKey(_TRACK_SY, 0.72, 3.10188302136786);
    effector:SetKey(_TRACK_SX, 0.88, 4.31957046332047);
    effector:SetKey(_TRACK_SY, 0.88, 0.54307593842285);
    effector:SetKey(_TRACK_SX, 4.7804296875, 1.31725386100387);
    effector:SetKey(_TRACK_SY, 4.7804296875, 0.34624462435015);
    effector:SetKey(_TRACK_SX, 5.08, 1.29872104247105);
    effector:SetKey(_TRACK_SY, 5.08, 0.57886345007243);
    effector:SetKey(_TRACK_SX, 5.4, 2.00296814671815);
    effector:SetKey(_TRACK_SY, 5.4, 2.2966640092523);
    effector:SetKey(_TRACK_SX, 5.5617578125, 2.37362451737452);
    effector:SetKey(_TRACK_SY, 5.5617578125, 2.13562020682919);
    effector:SetKey(_TRACK_SX, 5.7353515625, 2.48482142857144);
    effector:SetKey(_TRACK_SY, 5.7353515625, 1.40197621801279);
    effector:SetKey(_TRACK_SX, 5.908984375, 2.48482142857144);
    effector:SetKey(_TRACK_SY, 5.908984375, 0.4536071592989);
    effector:SetKey(_TRACK_O, 0, 0);
    effector:SetKey(_TRACK_O, 0.12, 1);
    effector:SetKey(_TRACK_O, 0.76, 0.8);
    effector:SetKey(_TRACK_O, 0.88, 0);
    effector:SetKey(_TRACK_O, 4.52, 0);
    effector:SetKey(_TRACK_O, 4.7804296875, 1);
    effector:SetKey(_TRACK_O, 5.908984375, 1);

    effector:Play();


    -- Layer Layer_2
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/EF_Meye01.jpg');
    element:SetName('Layer_2');
    compositionMonstr_Idle2:AddElement(element);
    element:SetHotSpot(22, 17);
    compositionMonstr_Idle2:RegisterParentInfo('Layer_2', 'Layer_5');
    element:SetXY(128.307857894328, 62.2395250348725);

    element:SetScaleX(1);
    element:SetScaleY(1);
    element:SetAngle(-0.29724734261683);

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

    effector:SetKey(_TRACK_O, 0, 0);
    effector:SetKey(_TRACK_O, 0.48, 0.6);
    effector:SetKey(_TRACK_O, 0.84, 0.2);
    effector:SetKey(_TRACK_O, 1.2, 0.6);
    effector:SetKey(_TRACK_O, 1.64, 0.2);
    effector:SetKey(_TRACK_O, 2.16, 0.6);
    effector:SetKey(_TRACK_O, 2.68, 0.2);
    effector:SetKey(_TRACK_O, 2.92, 0.6);
    effector:SetKey(_TRACK_O, 3.4, 0.2);
    effector:SetKey(_TRACK_O, 3.8, 0.6);
    effector:SetKey(_TRACK_O, 4.2, 0.2);
    effector:SetKey(_TRACK_O, 4.56, 0.6);
    effector:SetKey(_TRACK_O, 4.88, 0.2);
    effector:SetKey(_TRACK_O, 5.2, 0);

    effector:Play();


    -- Layer Layer_3
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/Mons_chel01.png');
    element:SetName('Layer_3');
    compositionMonstr_Idle2:AddElement(element);
    element:SetHotSpot(24, 30);
    compositionMonstr_Idle2:RegisterParentInfo('Layer_3', 'Layer_5');
    element:SetXY(112.567581176758, 98.4864959716797);

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

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

    effector:SetKey(_TRACK_A, 0, -0.41785448848626);
    effector:SetKey(_TRACK_A, 0.2, -0.18174441371956);
    effector:SetKey(_TRACK_A, 0.4, 0.65682902227078);
    effector:SetKey(_TRACK_A, 0.68, 0.15856166439613);
    effector:SetKey(_TRACK_A, 0.8, -0.347503955793);
    effector:SetKey(_TRACK_A, 0.92, 0.03071202607723);
    effector:SetKey(_TRACK_A, 1, -0.11051989554054);
    effector:SetKey(_TRACK_A, 1.08, -0.00062084998001);
    effector:SetKey(_TRACK_A, 1.24, -0.13365548863599);
    effector:SetKey(_TRACK_A, 1.4, -0.41199381291187);
    effector:SetKey(_TRACK_A, 2.32, -0.35902313791935);
    effector:SetKey(_TRACK_A, 2.6, -0.05613068655023);
    effector:SetKey(_TRACK_A, 2.72, 0.77860601888524);
    effector:SetKey(_TRACK_A, 2.92, -0.4521578653135);
    effector:SetKey(_TRACK_A, 3.44, -0.38536182908051);
    effector:SetKey(_TRACK_A, 3.76, 0.41575525431235);
    effector:SetKey(_TRACK_A, 4.6, -0.41194959125896);

    effector:Play();


    -- Layer Layer_4
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/Mons_yazik01.png');
    element:SetName('Layer_4');
    compositionMonstr_Idle2:AddElement(element);
    element:SetHotSpot(12, 18);
    compositionMonstr_Idle2:RegisterParentInfo('Layer_4', 'Layer_5');
    element:SetXY(118.772687475742, 102.203504786115);

    element:SetOpacity(1);

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

    effector:SetKey(_TRACK_SX, 0, 1);
    effector:SetKey(_TRACK_SY, 0, 1);
    effector:SetKey(_TRACK_SX, 0.56, 1.45170145491903);
    effector:SetKey(_TRACK_SY, 0.56, 1.05954392187765);
    effector:SetKey(_TRACK_SX, 0.84, 1.08468769862579);
    effector:SetKey(_TRACK_SY, 0.84, 0.6200449407112);
    effector:SetKey(_TRACK_SX, 1.56, 0.81449769187911);
    effector:SetKey(_TRACK_SY, 1.56, 0.6060209580269);
    effector:SetKey(_TRACK_SX, 2.28, 0.81449769187911);
    effector:SetKey(_TRACK_SY, 2.28, 0.6060209580269);
    effector:SetKey(_TRACK_SX, 2.36, 1.16972747718627);
    effector:SetKey(_TRACK_SY, 2.36, 0.73360297765939);
    effector:SetKey(_TRACK_SX, 2.64, 0.76642051597294);
    effector:SetKey(_TRACK_SY, 2.64, 0.92532358549277);
    effector:SetKey(_TRACK_SX, 2.68, 0.80918658740249);
    effector:SetKey(_TRACK_SY, 2.68, 0.82494691849803);
    effector:SetKey(_TRACK_SX, 2.8, 0.37747639176547);
    effector:SetKey(_TRACK_SY, 2.8, 0.58238303359463);
    effector:SetKey(_TRACK_A, 0, -0.19267510020066);
    effector:SetKey(_TRACK_A, 0.4, 0.80863195710313);
    effector:SetKey(_TRACK_A, 0.56, -0.00730378398355);
    effector:SetKey(_TRACK_A, 0.84, -0.23353433830793);
    effector:SetKey(_TRACK_A, 1.08, -0.27003297584553);
    effector:SetKey(_TRACK_A, 1.12, -0.0253134568304);
    effector:SetKey(_TRACK_A, 1.16, -0.33760371611287);
    effector:SetKey(_TRACK_A, 1.2, -0.09267555957195);
    effector:SetKey(_TRACK_A, 1.24, -0.32974079679443);
    effector:SetKey(_TRACK_A, 1.28, -0.21629814327944);
    effector:SetKey(_TRACK_A, 1.32, -0.40343358852478);
    effector:SetKey(_TRACK_A, 1.36, -0.35748568115845);
    effector:SetKey(_TRACK_A, 1.4, -0.37953424941629);
    effector:SetKey(_TRACK_A, 1.56, -0.10290518594989);
    effector:SetKey(_TRACK_A, 2.28, -0.10290518594989);
    effector:SetKey(_TRACK_A, 2.36, -0.44716685185759);
    effector:SetKey(_TRACK_A, 2.4, -0.31431052858397);
    effector:SetKey(_TRACK_A, 2.44, -0.40432522036716);
    effector:SetKey(_TRACK_A, 2.48, -0.30225263363866);
    effector:SetKey(_TRACK_A, 2.52, -0.39146001268371);
    effector:SetKey(_TRACK_A, 2.56, -0.31316131833633);
    effector:SetKey(_TRACK_A, 2.6, -0.41403748506019);
    effector:SetKey(_TRACK_A, 2.64, 0.17399654355352);
    effector:SetKey(_TRACK_A, 2.68, 0.53859228652593);
    effector:SetKey(_TRACK_A, 2.8, 0.34272240174884);
    effector:SetKey(_TRACK_A, 2.84, -0.08546085654303);

    effector:Play();


    -- Layer Layer_5
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/Mons_head01.png');
    element:SetName('Layer_5');
    compositionMonstr_Idle2:AddElement(element);
    element:SetHotSpot(97, 92);
    compositionMonstr_Idle2:RegisterParentInfo('Layer_5', 'Layer_6');
    element:SetXY(163.918914794922, 88.5135192871094);

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

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

    effector:SetKey(_TRACK_A, 0, -0.26378075721051);
    effector:SetKey(_TRACK_A, 0.48, 0.12518186089279);
    effector:SetKey(_TRACK_A, 1.04, -0.15309547726537);
    effector:SetKey(_TRACK_A, 1.48, 0.07846966756971);
    effector:SetKey(_TRACK_A, 2.24, -0.15140236452274);
    effector:SetKey(_TRACK_A, 2.64, 0.23520733262728);
    effector:SetKey(_TRACK_A, 2.96, 0.08697819933349);
    effector:SetKey(_TRACK_A, 3.08, -0.09661071792287);
    effector:SetKey(_TRACK_A, 3.76, 0.01571669932837);
    effector:SetKey(_TRACK_A, 4.4, 0.18089749609667);
    effector:SetKey(_TRACK_A, 4.76, -0.14628826182001);

    effector:Play();


    -- Layer Layer_6
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/Mons_head2_01.png');
    element:SetName('Layer_6');
    compositionMonstr_Idle2:AddElement(element);
    element:SetHotSpot(125, 95);
    compositionMonstr_Idle2:RegisterParentInfo('Layer_6', 'Layer_8');
    element:SetXY(256.53732415389, 154.840699290148);

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

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

    effector:SetKey(_TRACK_A, 0, 0.35064300440626);
    effector:SetKey(_TRACK_A, 0.32, 0.34285736259744);
    effector:SetKey(_TRACK_A, 0.88, 1.46916198464139);
    effector:SetKey(_TRACK_A, 1, 1.32441503766255);
    effector:SetKey(_TRACK_A, 1.2, 1.39184159385847);
    effector:SetKey(_TRACK_A, 1.32, 1.2975720546841);
    effector:SetKey(_TRACK_A, 2.04, 1.58401289202313);
    effector:SetKey(_TRACK_A, 2.44, 1.68625430732342);
    effector:SetKey(_TRACK_A, 2.92, 1.12668096134687);
    effector:SetKey(_TRACK_A, 3.88, 1.73218686392792);
    effector:SetKey(_TRACK_A, 4.28, 1.38066941616546);
    effector:SetKey(_TRACK_A, 4.72, 1.93418624584777);
    effector:SetKey(_TRACK_A, 4.92, 1.94914614687678);
    effector:SetKey(_TRACK_A, 5.2, 1.42929414480436);

    effector:Play();


    -- Layer Layer_7
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/Mons_lapka01.png');
    element:SetName('Layer_7');
    compositionMonstr_Idle2:AddElement(element);
    element:SetHotSpot(47, 25);
    compositionMonstr_Idle2:RegisterParentInfo('Layer_7', 'Layer_8');
    element:SetXY(178.104270199915, 102.428945714374);

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

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

    effector:SetKey(_TRACK_A, 0, 0.6207056722786);
    effector:SetKey(_TRACK_A, 0.56, -0.90977062264674);
    effector:SetKey(_TRACK_A, 0.92, 0.21267346599914);
    effector:SetKey(_TRACK_A, 1.4, -0.27128557677469);
    effector:SetKey(_TRACK_A, 1.76, 0.01838418396841);
    effector:SetKey(_TRACK_A, 2.48, -0.22626472301582);
    effector:SetKey(_TRACK_A, 2.92, 0.24030754413434);
    effector:SetKey(_TRACK_A, 3.52, -0.27728947530189);
    effector:SetKey(_TRACK_A, 4.24, 0.11464711524533);
    effector:SetKey(_TRACK_A, 5.16, -0.69704925010579);

    effector:Play();


    -- Layer Layer_8
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/Mons_spina01.png');
    element:SetName('Layer_8');
    compositionMonstr_Idle2:AddElement(element);
    element:SetHotSpot(109, 119);
    compositionMonstr_Idle2:RegisterParentInfo('Layer_8', 'Layer_10');
    element:SetXY(373.2562621593, 78.7153341303762);

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

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

    effector:SetKey(_TRACK_A, 0, 0.58070576246895);
    effector:SetKey(_TRACK_A, 0.48, 1.04247131544784);
    effector:SetKey(_TRACK_A, 1.04, 1.15434733498581);
    effector:SetKey(_TRACK_A, 1.48, 1.26351832840053);
    effector:SetKey(_TRACK_A, 2.12, 1.00724780723107);
    effector:SetKey(_TRACK_A, 2.68, 1.07346581678729);
    effector:SetKey(_TRACK_A, 2.92, 1.40173601402931);
    effector:SetKey(_TRACK_A, 3.88, 0.9102032534888);
    effector:SetKey(_TRACK_A, 4.56, 1.15554303980012);
    effector:SetKey(_TRACK_A, 4.84, 0.61770791752165);

    effector:Play();


    -- Layer Layer_9
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/Mons_lapka2_01.png');
    element:SetName('Layer_9');
    compositionMonstr_Idle2:AddElement(element);
    element:SetHotSpot(32, 12);
    compositionMonstr_Idle2:RegisterParentInfo('Layer_9', 'Layer_8');
    element:SetXY(185.28669983543, 138.113854352773);

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

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

    effector:SetKey(_TRACK_A, 0, -0.00604945279221);
    effector:SetKey(_TRACK_A, 0.4, 0.36503225669788);
    effector:SetKey(_TRACK_A, 0.68, -0.74518277933983);
    effector:SetKey(_TRACK_A, 1.32, 0.28070601948342);
    effector:SetKey(_TRACK_A, 2.2, -0.39466512670845);
    effector:SetKey(_TRACK_A, 2.96, 0.46828486012499);
    effector:SetKey(_TRACK_A, 3.6, -0.64786396539385);
    effector:SetKey(_TRACK_A, 4.2, -0.0082541622853);
    effector:SetKey(_TRACK_A, 4.8, -0.80360760644537);

    effector:Play();


    -- Layer Layer_10
    local element = auxCreateCompositionElement2('data/Texture/Scenes/21_Volcano/Animations/Monster/Mons_spina2_01.png');
    element:SetName('Layer_10');
    compositionMonstr_Idle2:AddElement(element);
    element:SetHotSpot(40, 60);
    element:SetParentElement(compositionMonstr_Idle2);
    element:SetScaleX(1);
    element:SetScaleY(1);
    element:SetOpacity(1);

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

    effector:SetKey(_TRACK_X, 0, 413);
    effector:SetKey(_TRACK_Y, 0, 1276);
    effector:SetKey(_TRACK_X, 0.44, 413);
    effector:SetKey(_TRACK_Y, 0.44, 874);
    effector:SetKey(_TRACK_X, 1.36, 401);
    effector:SetKey(_TRACK_Y, 1.36, 884);
    effector:SetKey(_TRACK_X, 2.56, 381);
    effector:SetKey(_TRACK_Y, 2.56, 860);
    effector:SetKey(_TRACK_X, 3.52, 377);
    effector:SetKey(_TRACK_Y, 3.52, 876);
    effector:SetKey(_TRACK_X, 4.48, 381);
    effector:SetKey(_TRACK_Y, 4.48, 852);
    effector:SetKey(_TRACK_X, 4.8, 407.666668293524);
    effector:SetKey(_TRACK_Y, 4.8, 1064.09518743026);
    effector:SetKey(_TRACK_X, 5.04, 570.896830742303);
    effector:SetKey(_TRACK_Y, 5.04, 1131.4392068748);
    effector:SetKey(_TRACK_X, 5.32, 729);
    effector:SetKey(_TRACK_Y, 5.32, 1268);
    effector:SetKey(_TRACK_A, 0, -2.17687081891079);
    effector:SetKey(_TRACK_A, 1.2, -1.96596165683756);
    effector:SetKey(_TRACK_A, 2.08, -1.90903543997292);
    effector:SetKey(_TRACK_A, 2.64, -1.96352221041208);
    effector:SetKey(_TRACK_A, 2.92, -1.80560807892543);
    effector:SetKey(_TRACK_A, 3.44, -1.93354247689392);
    effector:SetKey(_TRACK_A, 4.32, -1.94866141718562);
    effector:SetKey(_TRACK_A, 5.32, -2.04378035974785);

    effector:Play();

    compositionMonstr_Idle2:Play();

    return compositionMonstr_Idle2;
end
