Hung-Chi's Blog on github

Cocos2d-x教程教學》Lua動畫事件



add timeline

-- 新UI 動畫
local actionTmp = cc.CSLoader:createTimeline("csb/battleDescription2.csb")
csbNode:runAction(actionTmp)
actionTmp:gotoFrameAndPlay(0,false)

timeline event

-- 動畫事件
local function onFrameEvent(frame)
    if nil == frame then
        return
    end
    local str = frame:getEvent()
    if str == "end" or  str == "END" then
      print("123")
    end
end

actionTmp:play("start", true)
actionTmp:setFrameEventCallFunc(onFrameEvent)

Similar Posts


Comments


Advertisement