cocos creator 動作筆記(一)

2021-08-18 15:15:55 字數 1300 閱讀 3337

1、time時間完成當前node的大小到設定的縮放大小的轉變。

var action1 =cc.scaleto(time,scalex , scaley);
2、time時間node移動指定距離,正數向上,負數向下。

var action2 =cc.moveby(time, x, y);
3、time時間node移動到指定位置。

var action3 = cc.moveto(time, cc.p(x, y));
4、 速度漸變的移動。

var action4 = cc.moveby(1, cc.p(x, y)).easing(cc.easecubicactionout());

var action5 = cc.moveto(1, cc.p(x, y)).easing(cc.easecubicactionin());

5、順序執行 action1,action2 , action3。

var seq = cc.sequence(action1,action2,action3);

node.runaction(seq);

7、 順序執行 action1,action2 , action3。 動作重複執行兩次。

node.runaction(seq.repeat(2));
8、同時執行 action1,action2 , action3。

var spawn = cc.spawn(action1,action2,action3);

node.runaction(spawn);

9、執行定時輪詢任務

this.schedule(this.test, 0.2);

test:function

()

10、延遲方法

cc.delaytime(0.22)
注:執行 action1,action2 , action3…… 的 node 要和執行 runaction 的 node 是同乙個 node。

圖示閃爍顯示可以利用

cc.scaleto(),cc.moveby()/cc.moveto(),cc.delaytime(),cc.sequence() 等一些列動畫合作完成。

多個需要順序執行的動畫,但是不確定具體需要執行哪幾個,可以把需要執行的放進乙個陣列中,順序執行該陣列動畫。

cocosCreator動作詳解

元件的移動,旋轉 縮放等動畫效果稱為action 乙個元件可以同時執行多個action,小明一遍吃蛋糕一遍上廁所 runaction 執行動作 this node.runaction moveto 移動到指定位置 var mto cc.moveto 1 cc.v2 100,100 moveby 移動...

Cocos Creator 元件 動作Action

panel action.js var panel action type cc.enum var panel action cc.class action sequence action repeat action repeatforever action spawn action delayti...

cocos creator 十二 問題

1 socket為什麼不能使用 2 cocos類之攝像機使用問題 1 在使用socket為什麼不能使用 if cc.sys.isnative opts this sio window.io connect this.ip opts this sio.on connect function data ...