mirror of
https://github.com/wyb10a10/cocos_creator_framework.git
synced 2026-05-23 04:19:23 +08:00
41 lines
956 B
TypeScript
41 lines
956 B
TypeScript
import { Component, Label, _decorator, view, director, Node, RichText, tween, Tween, math, randomRange, Vec3 } from "cc";
|
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass
|
|
export default class SyncExample extends Component {
|
|
@property(Node)
|
|
leftNode: Node = null!;
|
|
@property(Node)
|
|
rightNode: Node = null!;
|
|
|
|
onLoad() {
|
|
}
|
|
|
|
onSyncClick() {
|
|
}
|
|
|
|
onRotateClick() {
|
|
let rot = this.leftNode.getRotation();
|
|
this.leftNode.rotate(rot);
|
|
}
|
|
|
|
onPosClick() {
|
|
let x = randomRange(-5, 5);
|
|
let y = randomRange(-5, 5);
|
|
let z = randomRange(-5, 5);
|
|
tween(this.leftNode)
|
|
.to(3.0, {position : new Vec3(x, y, z)})
|
|
.start();
|
|
}
|
|
|
|
onScaleClick() {
|
|
let scale = randomRange(0.1, 2.5);
|
|
tween(this.leftNode)
|
|
.to(3.0, {scale : new Vec3(scale, scale, scale)})
|
|
.start();
|
|
}
|
|
|
|
// update (dt) {}
|
|
}
|