添加动画

This commit is contained in:
宝爷
2021-09-07 23:22:32 +08:00
parent e9a037f9f1
commit 19934774cd
3 changed files with 234 additions and 195 deletions

View File

@@ -1,4 +1,4 @@
import { Component, Label, _decorator, view, director, Node, RichText } from "cc";
import { Component, Label, _decorator, view, director, Node, RichText, tween, Tween, math, randomRange, Vec3 } from "cc";
const { ccclass, property } = _decorator;
@@ -16,13 +16,24 @@ export default class SyncExample extends Component {
}
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) {}