2012-08-30 15:35:04 +08:00
|
|
|
local kTagAction1 = 1
|
|
|
|
local kTagAction2 = 2
|
|
|
|
local kTagSlider = 1
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local s = cc.Director:getInstance():getWinSize()
|
|
|
|
local scheduler = cc.Director:getInstance():getScheduler()
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local function createSimpleMoveBy()
|
2013-08-14 21:35:55 +08:00
|
|
|
return cc.MoveBy:create(3, cc.p(s.width - 130, 0))
|
2013-03-01 17:09:42 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
local function createSimpleDelayTime()
|
2013-08-14 21:35:55 +08:00
|
|
|
return cc.DelayTime:create(0.25)
|
2013-03-01 17:09:42 +08:00
|
|
|
end
|
|
|
|
|
2012-08-30 15:35:04 +08:00
|
|
|
local function positionForTwo()
|
2013-08-14 21:35:55 +08:00
|
|
|
grossini:setPosition(cc.p(60, s.height * 1 / 5))
|
|
|
|
tamara:setPosition(cc.p(60, s.height * 4 / 5))
|
2012-08-30 15:35:04 +08:00
|
|
|
kathia:setVisible(false)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function getBaseLayer()
|
2013-08-14 21:35:55 +08:00
|
|
|
local layer = cc.Layer:create()
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
grossini = cc.Sprite:create(s_pPathGrossini)
|
|
|
|
tamara = cc.Sprite:create(s_pPathSister1)
|
|
|
|
kathia = cc.Sprite:create(s_pPathSister2)
|
2012-08-30 15:35:04 +08:00
|
|
|
|
|
|
|
layer:addChild(grossini, 3)
|
|
|
|
layer:addChild(kathia, 2)
|
|
|
|
layer:addChild(tamara, 1)
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
grossini:setPosition(cc.p(60, s.height * 1 / 5))
|
|
|
|
kathia:setPosition(cc.p(60, s.height * 2.5 / 5))
|
|
|
|
tamara:setPosition(cc.p(60, s.height * 4 / 5))
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-03-13 17:45:09 +08:00
|
|
|
Helper.initWithLayer(layer)
|
2012-08-30 15:35:04 +08:00
|
|
|
|
|
|
|
return layer
|
|
|
|
end
|
|
|
|
|
|
|
|
-----------------------------------
|
|
|
|
-- SpriteEase
|
|
|
|
-----------------------------------
|
|
|
|
local SpriteEase_entry = nil
|
|
|
|
|
|
|
|
local function testStopAction(dt)
|
|
|
|
scheduler:unscheduleScriptEntry(SpriteEase_entry)
|
|
|
|
tamara:stopActionByTag(1)
|
|
|
|
kathia:stopActionByTag(1)
|
|
|
|
grossini:stopActionByTag(1)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function SpriteEase_onEnterOrExit(tag)
|
2013-03-05 14:46:18 +08:00
|
|
|
if tag == "enter" then
|
2012-08-30 15:35:04 +08:00
|
|
|
SpriteEase_entry = scheduler:scheduleScriptFunc(testStopAction, 6.25, false)
|
2013-03-05 14:46:18 +08:00
|
|
|
elseif tag == "exit" then
|
2012-08-30 15:35:04 +08:00
|
|
|
scheduler:unscheduleScriptEntry(SpriteEase_entry)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local function SpriteEase()
|
|
|
|
local layer = getBaseLayer()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local move = createSimpleMoveBy()
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_back = move:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_in = cc.EaseIn:create(createSimpleMoveBy(), 2.5)
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_in_back = move_ease_in:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_out = cc.EaseOut:create(createSimpleMoveBy(), 2.5)
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_out_back = move_ease_out:reverse()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local delay = createSimpleDelayTime()
|
2013-08-14 21:35:55 +08:00
|
|
|
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
|
|
|
|
local seq2 = cc.Sequence:create(move_ease_in,createSimpleDelayTime(),move_ease_in_back,createSimpleDelayTime())
|
|
|
|
local seq3 = cc.Sequence:create(move_ease_out,createSimpleDelayTime(),move_ease_out_back,createSimpleDelayTime())
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local a2 = grossini:runAction(cc.RepeatForever:create(seq1))
|
2012-08-30 15:35:04 +08:00
|
|
|
a2:setTag(1)
|
2013-08-14 21:35:55 +08:00
|
|
|
local a1 = tamara:runAction(cc.RepeatForever:create(seq2))
|
2012-08-30 15:35:04 +08:00
|
|
|
a1:setTag(1)
|
2013-08-14 21:35:55 +08:00
|
|
|
local a = kathia:runAction(cc.RepeatForever:create(seq3))
|
2012-08-30 15:35:04 +08:00
|
|
|
a:setTag(1)
|
|
|
|
|
|
|
|
layer:registerScriptHandler(SpriteEase_onEnterOrExit)
|
|
|
|
|
2013-03-13 17:45:09 +08:00
|
|
|
Helper.titleLabel:setString("EaseIn - EaseOut - Stop")
|
2012-08-30 15:35:04 +08:00
|
|
|
return layer
|
|
|
|
end
|
|
|
|
|
|
|
|
-----------------------------------
|
|
|
|
-- SpriteEaseInOut
|
|
|
|
-----------------------------------
|
|
|
|
local function SpriteEaseInOut()
|
|
|
|
local layer = getBaseLayer()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local move = createSimpleMoveBy()
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_inout1 = cc.EaseInOut:create(createSimpleMoveBy(), 0.65)
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_inout_back1 = move_ease_inout1:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_inout2 = cc.EaseInOut:create(createSimpleMoveBy(), 1.35)
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_inout_back2 = move_ease_inout2:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_inout3 = cc.EaseInOut:create(createSimpleMoveBy(), 1.0)
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_inout_back3 = move_ease_inout3:reverse()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local delay = createSimpleDelayTime()
|
2013-08-14 21:35:55 +08:00
|
|
|
local seq1 = cc.Sequence:create(move_ease_inout1,delay,move_ease_inout_back1,createSimpleDelayTime())
|
|
|
|
local seq2 = cc.Sequence:create(move_ease_inout2,createSimpleDelayTime(),move_ease_inout_back2,createSimpleDelayTime())
|
|
|
|
local seq3 = cc.Sequence:create(move_ease_inout3, createSimpleDelayTime(), move_ease_inout_back3, createSimpleDelayTime() )
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
tamara:runAction(cc.RepeatForever:create(seq1))
|
|
|
|
kathia:runAction(cc.RepeatForever:create(seq2))
|
|
|
|
grossini:runAction(cc.RepeatForever:create(seq3))
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-03-13 17:45:09 +08:00
|
|
|
Helper.titleLabel:setString("EaseInOut and rates")
|
2012-08-30 15:35:04 +08:00
|
|
|
return layer
|
|
|
|
end
|
|
|
|
|
|
|
|
-----------------------------------
|
|
|
|
-- SpriteEaseExponential
|
|
|
|
-----------------------------------
|
|
|
|
local function SpriteEaseExponential()
|
|
|
|
local layer = getBaseLayer()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local move = createSimpleMoveBy()
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_back = move:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_in = cc.EaseExponentialIn:create(createSimpleMoveBy())
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_in_back = move_ease_in:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_out = cc.EaseExponentialOut:create(createSimpleMoveBy())
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_out_back = move_ease_out:reverse()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local delay = createSimpleDelayTime()
|
2013-08-23 16:12:59 +08:00
|
|
|
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
|
|
|
|
local seq2 = cc.Sequence:create(move_ease_in, createSimpleDelayTime(), move_ease_in_back, createSimpleDelayTime())
|
|
|
|
local seq3 = cc.Sequence:create(move_ease_out, createSimpleDelayTime(), move_ease_out_back, createSimpleDelayTime())
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
grossini:runAction(cc.RepeatForever:create(seq1))
|
|
|
|
tamara:runAction(cc.RepeatForever:create(seq2))
|
|
|
|
kathia:runAction(cc.RepeatForever:create(seq3))
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-03-13 17:45:09 +08:00
|
|
|
Helper.titleLabel:setString("ExpIn - ExpOut actions")
|
2012-08-30 15:35:04 +08:00
|
|
|
return layer
|
|
|
|
end
|
|
|
|
|
|
|
|
-----------------------------------
|
|
|
|
-- SpriteEaseExponentialInOut
|
|
|
|
-----------------------------------
|
|
|
|
local function SpriteEaseExponentialInOut()
|
|
|
|
local layer = getBaseLayer()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local move = createSimpleMoveBy()
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_back = move:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease = cc.EaseExponentialInOut:create(createSimpleMoveBy())
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_back = move_ease:reverse()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local delay = createSimpleDelayTime()
|
2013-08-14 21:35:55 +08:00
|
|
|
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
|
|
|
|
local seq2 = cc.Sequence:create(move_ease, createSimpleDelayTime(), move_ease_back, createSimpleDelayTime() )
|
2012-08-30 15:35:04 +08:00
|
|
|
|
|
|
|
positionForTwo()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
grossini:runAction(cc.RepeatForever:create(seq1))
|
|
|
|
tamara:runAction(cc.RepeatForever:create(seq2))
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-03-13 17:45:09 +08:00
|
|
|
Helper.titleLabel:setString("EaseExponentialInOut action")
|
2012-08-30 15:35:04 +08:00
|
|
|
return layer
|
|
|
|
end
|
|
|
|
|
|
|
|
-----------------------------------
|
|
|
|
-- SpriteEaseSine
|
|
|
|
-----------------------------------
|
|
|
|
local function SpriteEaseSine()
|
|
|
|
local layer = getBaseLayer()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local move = createSimpleMoveBy()
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_back = move:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_in = cc.EaseSineIn:create(createSimpleMoveBy())
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_in_back = move_ease_in:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_out = cc.EaseSineOut:create(createSimpleMoveBy())
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_out_back = move_ease_out:reverse()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local delay = createSimpleDelayTime()
|
2013-08-14 21:35:55 +08:00
|
|
|
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime() )
|
2013-08-23 16:12:59 +08:00
|
|
|
local seq2 = cc.Sequence:create(move_ease_in, createSimpleDelayTime(), move_ease_in_back, createSimpleDelayTime())
|
|
|
|
local seq3 = cc.Sequence:create(move_ease_out, createSimpleDelayTime(), move_ease_out_back,createSimpleDelayTime())
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
grossini:runAction(cc.RepeatForever:create(seq1))
|
|
|
|
tamara:runAction(cc.RepeatForever:create(seq2))
|
|
|
|
kathia:runAction(cc.RepeatForever:create(seq3))
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-03-13 17:45:09 +08:00
|
|
|
Helper.titleLabel:setString("EaseSineIn - EaseSineOut")
|
2012-08-30 15:35:04 +08:00
|
|
|
return layer
|
|
|
|
end
|
|
|
|
|
|
|
|
-----------------------------------
|
|
|
|
-- SpriteEaseSineInOut
|
|
|
|
-----------------------------------
|
|
|
|
local function SpriteEaseSineInOut()
|
|
|
|
local layer = getBaseLayer()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local move = createSimpleMoveBy()
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_back = move:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease = cc.EaseSineInOut:create(createSimpleMoveBy())
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_back = move_ease:reverse()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local delay = createSimpleDelayTime()
|
2013-08-23 16:12:59 +08:00
|
|
|
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
|
2013-08-14 21:35:55 +08:00
|
|
|
local seq2 = cc.Sequence:create(move_ease, createSimpleDelayTime(), move_ease_back, createSimpleDelayTime())
|
2012-08-30 15:35:04 +08:00
|
|
|
|
|
|
|
positionForTwo()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
grossini:runAction(cc.RepeatForever:create(seq1))
|
|
|
|
tamara:runAction(cc.RepeatForever:create(seq2))
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-03-13 17:45:09 +08:00
|
|
|
Helper.titleLabel:setString("EaseSineInOut action")
|
2012-08-30 15:35:04 +08:00
|
|
|
return layer
|
|
|
|
end
|
|
|
|
|
|
|
|
-----------------------------------
|
|
|
|
-- SpriteEaseElastic
|
|
|
|
-----------------------------------
|
|
|
|
local function SpriteEaseElastic()
|
|
|
|
local layer = getBaseLayer()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local move = createSimpleMoveBy()
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_back = move:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_in = cc.EaseElasticIn:create(createSimpleMoveBy())
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_in_back = move_ease_in:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_out = cc.EaseElasticOut:create(createSimpleMoveBy())
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_out_back = move_ease_out:reverse()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local delay = createSimpleDelayTime()
|
2013-08-14 21:35:55 +08:00
|
|
|
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime() )
|
|
|
|
local seq2 = cc.Sequence:create(move_ease_in, createSimpleDelayTime(), move_ease_in_back, createSimpleDelayTime())
|
|
|
|
local seq3 = cc.Sequence:create(move_ease_out, createSimpleDelayTime(), move_ease_out_back, createSimpleDelayTime())
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
grossini:runAction(cc.RepeatForever:create(seq1))
|
|
|
|
tamara:runAction(cc.RepeatForever:create(seq2))
|
|
|
|
kathia:runAction(cc.RepeatForever:create(seq3))
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-03-13 17:45:09 +08:00
|
|
|
Helper.titleLabel:setString("Elastic In - Out actions")
|
2012-08-30 15:35:04 +08:00
|
|
|
return layer
|
|
|
|
end
|
|
|
|
|
|
|
|
-----------------------------------
|
|
|
|
-- SpriteEaseElasticInOut
|
|
|
|
-----------------------------------
|
|
|
|
local function SpriteEaseElasticInOut()
|
|
|
|
local layer = getBaseLayer()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local move = createSimpleMoveBy()
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_inout1 = cc.EaseElasticInOut:create(createSimpleMoveBy(), 0.3)
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_inout_back1 = move_ease_inout1:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_inout2 = cc.EaseElasticInOut:create(createSimpleMoveBy(), 0.45)
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_inout_back2 = move_ease_inout2:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_inout3 = cc.EaseElasticInOut:create(createSimpleMoveBy(), 0.6)
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_inout_back3 = move_ease_inout3:reverse()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local delay = createSimpleDelayTime()
|
2013-08-14 21:35:55 +08:00
|
|
|
local seq1 = cc.Sequence:create(move_ease_inout1, delay, move_ease_inout_back1, createSimpleDelayTime())
|
|
|
|
local seq2 = cc.Sequence:create(move_ease_inout2, createSimpleDelayTime(), move_ease_inout_back2, createSimpleDelayTime())
|
|
|
|
local seq3 = cc.Sequence:create(move_ease_inout3, createSimpleDelayTime(), move_ease_inout_back3, createSimpleDelayTime())
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
tamara:runAction(cc.RepeatForever:create(seq1))
|
|
|
|
kathia:runAction(cc.RepeatForever:create(seq2))
|
|
|
|
grossini:runAction(cc.RepeatForever:create(seq3))
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-03-13 17:45:09 +08:00
|
|
|
Helper.titleLabel:setString("EaseElasticInOut action")
|
2012-08-30 15:35:04 +08:00
|
|
|
return layer
|
|
|
|
end
|
|
|
|
|
|
|
|
-----------------------------------
|
|
|
|
-- SpriteEaseBounce
|
|
|
|
-----------------------------------
|
|
|
|
local function SpriteEaseBounce()
|
|
|
|
local layer = getBaseLayer()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local move = createSimpleMoveBy()
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_back = move:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_in = cc.EaseBounceIn:create(createSimpleMoveBy())
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_in_back = move_ease_in:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_out = cc.EaseBounceOut:create(createSimpleMoveBy())
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_out_back = move_ease_out:reverse()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local delay = createSimpleDelayTime()
|
2013-08-14 21:35:55 +08:00
|
|
|
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime() )
|
2013-08-23 16:12:59 +08:00
|
|
|
local seq2 = cc.Sequence:create(move_ease_in, createSimpleDelayTime(), move_ease_in_back, createSimpleDelayTime())
|
2013-08-14 21:35:55 +08:00
|
|
|
local seq3 = cc.Sequence:create(move_ease_out, createSimpleDelayTime(), move_ease_out_back, createSimpleDelayTime())
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
grossini:runAction(cc.RepeatForever:create(seq1))
|
|
|
|
tamara:runAction(cc.RepeatForever:create(seq2))
|
|
|
|
kathia:runAction(cc.RepeatForever:create(seq3))
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-03-13 17:45:09 +08:00
|
|
|
Helper.titleLabel:setString("Bounce In - Out actions")
|
2012-08-30 15:35:04 +08:00
|
|
|
return layer
|
|
|
|
end
|
|
|
|
|
|
|
|
-----------------------------------
|
|
|
|
-- SpriteEaseBounceInOut
|
|
|
|
-----------------------------------
|
|
|
|
local function SpriteEaseBounceInOut()
|
|
|
|
local layer = getBaseLayer()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local move = createSimpleMoveBy()
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_back = move:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease = cc.EaseBounceInOut:create(createSimpleMoveBy())
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_back = move_ease:reverse()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local delay = createSimpleDelayTime()
|
2013-08-14 21:35:55 +08:00
|
|
|
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
|
|
|
|
local seq2 = cc.Sequence:create(move_ease, createSimpleDelayTime(), move_ease_back, createSimpleDelayTime())
|
2012-08-30 15:35:04 +08:00
|
|
|
|
|
|
|
positionForTwo()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
grossini:runAction(cc.RepeatForever:create(seq1))
|
|
|
|
tamara:runAction(cc.RepeatForever:create(seq2))
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-03-13 17:45:09 +08:00
|
|
|
Helper.titleLabel:setString("EaseBounceInOut action")
|
2012-08-30 15:35:04 +08:00
|
|
|
return layer
|
|
|
|
end
|
|
|
|
|
|
|
|
-----------------------------------
|
|
|
|
-- SpriteEaseBack
|
|
|
|
-----------------------------------
|
|
|
|
local function SpriteEaseBack()
|
|
|
|
local layer = getBaseLayer()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local move = createSimpleMoveBy()
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_back = move:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_in = cc.EaseBackIn:create(createSimpleMoveBy())
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_in_back = move_ease_in:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease_out = cc.EaseBackOut:create(createSimpleMoveBy())
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_out_back = move_ease_out:reverse()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local delay = createSimpleDelayTime()
|
2013-08-14 21:35:55 +08:00
|
|
|
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
|
|
|
|
local seq2 = cc.Sequence:create(move_ease_in, createSimpleDelayTime(), move_ease_in_back, createSimpleDelayTime())
|
|
|
|
local seq3 = cc.Sequence:create(move_ease_out, createSimpleDelayTime(), move_ease_out_back, createSimpleDelayTime())
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
grossini:runAction(cc.RepeatForever:create(seq1))
|
|
|
|
tamara:runAction(cc.RepeatForever:create(seq2))
|
|
|
|
kathia:runAction(cc.RepeatForever:create(seq3))
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-03-13 17:45:09 +08:00
|
|
|
Helper.titleLabel:setString("Back In - Out actions")
|
2012-08-30 15:35:04 +08:00
|
|
|
return layer
|
|
|
|
end
|
|
|
|
|
|
|
|
-----------------------------------
|
|
|
|
-- SpriteEaseBackInOut
|
|
|
|
-----------------------------------
|
|
|
|
local function SpriteEaseBackInOut()
|
|
|
|
local layer = getBaseLayer()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local move = createSimpleMoveBy()
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_back = move:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local move_ease = cc.EaseBackInOut:create(createSimpleMoveBy())
|
2012-08-30 15:35:04 +08:00
|
|
|
local move_ease_back = move_ease:reverse()
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
local delay = createSimpleDelayTime()
|
2013-08-14 21:35:55 +08:00
|
|
|
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
|
|
|
|
local seq2 = cc.Sequence:create(move_ease,createSimpleDelayTime(), move_ease_back, createSimpleDelayTime())
|
2012-08-30 15:35:04 +08:00
|
|
|
|
|
|
|
positionForTwo()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
grossini:runAction(cc.RepeatForever:create(seq1))
|
|
|
|
tamara:runAction(cc.RepeatForever:create(seq2))
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-03-13 17:45:09 +08:00
|
|
|
Helper.titleLabel:setString("EaseBackInOut action")
|
2012-08-30 15:35:04 +08:00
|
|
|
return layer
|
|
|
|
end
|
|
|
|
|
|
|
|
-----------------------------------
|
|
|
|
-- SpeedTest
|
|
|
|
-----------------------------------
|
|
|
|
local SpeedTest_entry = nil
|
|
|
|
local SpeedTest_action1 = nil
|
|
|
|
local SpeedTest_action2 = nil
|
|
|
|
local SpeedTest_action3 = nil
|
|
|
|
|
|
|
|
local function altertime(dt)
|
|
|
|
SpeedTest_action1:setSpeed(math.random() * 2)
|
|
|
|
SpeedTest_action2:setSpeed(math.random() * 2)
|
|
|
|
SpeedTest_action3:setSpeed(math.random() * 2)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function SpeedTest_onEnterOrExit(tag)
|
2013-03-01 17:09:42 +08:00
|
|
|
if tag == "enter" then
|
2012-08-30 15:35:04 +08:00
|
|
|
SpeedTest_entry = scheduler:scheduleScriptFunc(altertime, 1.0, false)
|
2013-03-01 17:09:42 +08:00
|
|
|
elseif tag == "exit" then
|
2012-08-30 15:35:04 +08:00
|
|
|
scheduler:unscheduleScriptEntry(SpeedTest_entry)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local function SpeedTest()
|
|
|
|
local layer = getBaseLayer()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local jump1 = cc.JumpBy:create(4, cc.p(- s.width + 80, 0), 100, 4)
|
2012-08-30 15:35:04 +08:00
|
|
|
local jump2 = jump1:reverse()
|
2013-08-14 21:35:55 +08:00
|
|
|
local rot1 = cc.RotateBy:create(4, 360 * 2)
|
2012-08-30 15:35:04 +08:00
|
|
|
local rot2 = rot1:reverse()
|
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local seq3_1 = cc.Sequence:create(jump2, jump1)
|
|
|
|
local seq3_2 = cc.Sequence:create(rot1, rot2)
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2013-08-14 21:35:55 +08:00
|
|
|
local spawn = cc.Spawn:create(seq3_1, seq3_2)
|
|
|
|
SpeedTest_action1 = cc.Speed:create(cc.RepeatForever:create(spawn), 1.0)
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2014-01-17 11:22:03 +08:00
|
|
|
local spawn2 = tolua.cast(spawn:clone(), "cc.Spawn")
|
2013-08-14 21:35:55 +08:00
|
|
|
SpeedTest_action2 = cc.Speed:create(cc.RepeatForever:create(spawn2), 1.0)
|
2012-08-30 15:35:04 +08:00
|
|
|
|
2014-01-17 11:22:03 +08:00
|
|
|
local spawn3 = tolua.cast(spawn:clone(), "cc.Spawn")
|
2013-08-14 21:35:55 +08:00
|
|
|
SpeedTest_action3 = cc.Speed:create(cc.RepeatForever:create(spawn3), 1.0)
|
2012-08-30 15:35:04 +08:00
|
|
|
|
|
|
|
grossini:runAction(SpeedTest_action2)
|
|
|
|
tamara:runAction(SpeedTest_action3)
|
|
|
|
kathia:runAction(SpeedTest_action1)
|
|
|
|
|
|
|
|
layer:registerScriptHandler(SpeedTest_onEnterOrExit)
|
|
|
|
|
2013-03-13 17:45:09 +08:00
|
|
|
Helper.titleLabel:setString("Speed action")
|
2012-08-30 15:35:04 +08:00
|
|
|
return layer
|
|
|
|
end
|
|
|
|
|
|
|
|
function EaseActionsTest()
|
2013-08-14 21:35:55 +08:00
|
|
|
local scene = cc.Scene:create()
|
2013-03-13 17:45:09 +08:00
|
|
|
cclog("EaseActionsTest")
|
|
|
|
|
|
|
|
Helper.createFunctionTable = {
|
|
|
|
SpriteEase,
|
|
|
|
SpriteEaseInOut,
|
|
|
|
SpriteEaseExponential,
|
|
|
|
SpriteEaseExponentialInOut,
|
|
|
|
SpriteEaseSine,
|
|
|
|
SpriteEaseSineInOut,
|
|
|
|
SpriteEaseElastic,
|
|
|
|
SpriteEaseElasticInOut,
|
|
|
|
SpriteEaseBounce,
|
|
|
|
SpriteEaseBounceInOut,
|
|
|
|
SpriteEaseBack,
|
|
|
|
SpriteEaseBackInOut,
|
|
|
|
SpeedTest
|
|
|
|
}
|
|
|
|
|
|
|
|
scene:addChild(SpriteEase())
|
2012-08-30 15:35:04 +08:00
|
|
|
scene:addChild(CreateBackMenuItem())
|
|
|
|
|
|
|
|
return scene
|
|
|
|
end
|