cocos-lua3.17 cocos studio lua动画使用

这里只贴具体使用代码,资源请使用自己的。

这里的资源是cocos studio导出的lua文件,其中就有root和动画

 function GameLayer:playLhAni()
    local ani = require("game/pk/lh/res/default/ani/l111.lua").create()
    ccui.Helper:seekWidgetByName(self.mid[2],"Panel_zhouma"):addChild(ani.root)
    ani.root:runAction(ani.animation)
    ani.animation:gotoFrameAndPlay(0,false
 --但是他的自带回调方法,进不去,项目较赶,使用延时函数代替
end
 
csb文件使用:
local sizeOfView = playerView:getContentSize()
                playerView._alertEffect = cc.CSLoader:createNode("res/animation/alert.csb")
                local action = cc.CSLoader:createTimeline("res/animation/alert.csb")
                playerView._alertEffect:runAction(action)
                action:play("alert", true)
                playerView:addChild(playerView._alertEffect)
                playerView._alertEffect:setPosition(cc.p(sizeOfView.width / 2, 50))
原文地址:https://www.cnblogs.com/zhangthree/p/10481837.html