mirror of
https://github.com/wyb10a10/cocos_creator_framework.git
synced 2026-06-04 07:47:19 +08:00
添加动画
This commit is contained in:
@@ -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) {}
|
||||
|
||||
Reference in New Issue
Block a user