// Learn TypeScript: // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html const {ccclass, property} = cc._decorator; @ccclass export default class NewClass extends cc.Component { // @property(cc.Label) // label: cc.Label = null; // @property // text: string = 'hello'; onLoad () { this.node.on(cc.Node.EventType.MOUSE_DOWN, this.move, this); } move() { //抓取節點node var node1 = cc.find("Canvas/大雄"); //目的地 var p1 = cc.v3(300, -72, 0); //直接移動 //node1.setPosition(p1); //2秒緩動 // cc.tween(node1) // .to(2,{position: p1}) // .start(); //2秒緩動+同時旋轉 // cc.tween(node1) // .to(2,{position: p1, rotation: 360}) // .start(); //2秒緩動,再1秒旋轉 cc.tween(node1) .to(2,{position: p1}) .to(1,{rotation: 360}) .start(); } start () { } // update (dt) {} }