复合动作
ActionEaseBackIn(action) 加速度向右,反方向缓慢移动
参数 |
必选 |
类型 |
注释 |
action |
是 |
obj |
动作对象 |
先理解action是什么
可执行的动作对象 几个特征
继承cocos的基本动作 cc.Action
包含时间 速度 目标节点等属性其中
通过runAction() 绑定游戏对象
EaseBackIn
可实现攻击后退
local parent = GUI:Attach_LeftBottom()
local oldBtn = GUI:getChildByName(parent, "btn1")
if oldBtn then
GUI:removeFromParent(oldBtn)
end
local btn = GUI:Button_Create(parent, "btn1", 200, 500, "res/public_win32/zhunxing.png")
if not btn then
SL:Print("按钮创建失败")
return
end
GUI:removeAllChildren(btn)
local moveAction = GUI:ActionMoveTo(1, 500, 500)
if moveAction then
local easeAction = GUI:ActionEaseBackIn(moveAction)
GUI:runAction(btn, easeAction)
else
SL:Print("错误")
end
ActionEaseBackOut
实现后摇 野蛮冲撞 冲锋等效果 ActionEaseBackOut
local parent = GUI:Attach_LeftBottom()
local oldBtn = GUI:getChildByName(parent, "btn1")
if oldBtn then
GUI:removeFromParent(oldBtn)
end
local btn = GUI:Button_Create(parent, "btn1", 300, 300, "res/public_win32/zhunxing.png")
if not btn then
SL:Print("按钮创建失败")
return
end
GUI:removeAllChildren(btn)
local moveAction = GUI:ActionMoveBy(0.8, 550, 0)
if moveAction then
local easeAction = GUI:ActionEaseBackIn(moveAction)
GUI:runAction(btn, easeAction)
else
SL:Print("错误")
end
眩晕震荡效果
local parent = GUI:Attach_LeftBottom()
local oldBtn = GUI:getChildByName(parent, "btn1")
if oldBtn then
GUI:removeFromParent(oldBtn)
end
local btn = GUI:Button_Create(parent, "btn1", 200, 500, "res/public_win32/zhunxing.png")
if not btn then
SL:Print("按钮创建失败")
return
end
GUI:removeAllChildren(btn)
local rotateAction = GUI:ActionRotateBy(1, 200,200)
local shakeAction = GUI:ActionSequence({
GUI:ActionMoveBy(0.5, 0, 10),
GUI:ActionMoveBy(0.5, 0, -10),
GUI:ActionMoveBy(0.5, 0, 10)
})
local easeDizzy = GUI:ActionEaseElasticIn(
GUI:ActionSpawn({rotateAction, shakeAction})
)
GUI:runAction(btn, easeDizzy)