//JSON
//序列化
let a = new Person(101, "aaa");
let str = JSON.stringify(a);
console.log(str);
//反序列化
let person = Object.assign(new Person(), JSON.parse(str));
cc.log(person.id + "\t" + person.name);
移动
//let action = cc.moveBy(3, 200, 200);// 用3秒移动(200, 200);
//action = cc.moveTo(3, 200, 200);//用3秒移动到(200,200);
旋转
//action = cc.rotateTo(3, 153);//用3秒旋转到153度;
//action = cc.rotateBy(3, 135);//用3秒旋转153度
缩放
//action = cc.scaleTo(3, 2);//用3秒缩放x和y轴缩放到2倍
//action = cc.scaleBy(3, 2); //用3秒缩放x和y轴缩放2倍
//action = cc.scaleBy(3, 2, 1); //用3秒缩放x轴缩放到2倍,y轴不变
跳跃
//action = cc.jumpTo(3, cc.v2(100, 100), 100, 2);//用3秒跳跃到(100, 100),100高度,2次数
//action = cc.jumpBy(3, cc.v2(100, 100), 100, 2);//用3秒跳跃(100, 100),100高度,2次数
闪烁
//action = cc.blink(3, 5);//用3秒闪烁5次
淡入淡出
//action = cc.fadeIn(3);//用3秒淡入
//action = cc.fadeOut(3);//用3秒淡出
透明变色
//action = cc.fadeTo(3, 100); //用3秒变透明
//action = cc.tintTo(3, 255, 0, 0); //用3秒变红色
//action = cc.tintBy(3, 255, 0, 0); //用3秒变红色
队列
//let action2 = cc.moveTo(3, 200, 200);
//let seq = cc.sequence(action, action2);
//seq = cc.sequence(action, action2, cc.callFunc(() => {
// console.log("aaaa");
//}));
//let aa = cc.repeat(seq, 3);//执行3次队列
//aa = cc.repeatForever(seq);//永远执行
//let bb = cc.spawn(action, action2);//两个动作同时执行
//this.node.runAction(bb);//执行动作
Cocos简单了解
最新推荐文章于 2024-08-23 23:21:06 发布