This commit is contained in:
2026-07-14 11:44:07 +08:00
commit 4409c7b031
5906 changed files with 6959792 additions and 0 deletions
@@ -0,0 +1,64 @@
import { _decorator, Component, easing, Node, tween, Vec2, Vec3 } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('MoveComponent')
export class MoveComponent extends Component {
@property
startPos: Vec3 = new Vec3(0, 0, 0);
@property
endPos: Vec3 = new Vec3(0, 0, 0);
@property
delay: number = 0;
@property
moveTimer: number = 0;
@property({ displayName: "线性" })
line: boolean = true;
@property({ displayName: "先慢后快" })
sineIn: boolean = true;
@property({ displayName: "先快后慢" })
sineOut: boolean = true;
@property({ displayName: "设置为初始值" })
setToStart: boolean = false;
protected onEnable(): void {
console.log("触发动画z")
let easeFunc = easing.linear;
if (this.sineIn) {
easeFunc = easing.sineIn
}
if (this.sineOut) {
easeFunc = easing.sineOut
}
if (this.setToStart) {
this.node.setPosition(this.startPos)
}
tween(this.node)
.delay(this.delay)
.call(() => {
this.node.setPosition(this.startPos)
})
.to(this.moveTimer, { position: this.endPos }, { easing: easeFunc })
.start()
}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "19cd6700-3735-446f-8b08-79fed0ed5cb3",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,63 @@
import { _decorator, Component, easing, Node, tween, Vec2, Vec3 } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('ScaleComponent')
export class ScaleComponent extends Component {
@property
startPos: Vec3 = new Vec3(0, 0, 0);
@property
endPos: Vec3 = new Vec3(1, 1, 1);
@property
delay: number = 0;
@property
moveTimer: number = 0.1;
@property({ displayName: "线性" })
line: boolean = true;
@property({ displayName: "先慢后快" })
sineIn: boolean = true;
@property({ displayName: "先快后慢" })
sineOut: boolean = true;
@property({ displayName: "设置为初始值" })
setToStart: boolean = false;
protected onEnable(): void {
let easeFunc = easing.linear;
if (this.sineIn) {
easeFunc = easing.sineIn
}
if (this.sineOut) {
easeFunc = easing.sineOut
}
if (this.setToStart) {
this.node.setScale(this.startPos)
}
tween(this.node)
.delay(this.delay)
.call(() => {
this.node.setScale(this.startPos)
})
.to(this.moveTimer, { scale: this.endPos }, { easing: easeFunc })
.start()
}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "f63e6af0-009f-444e-a875-237d4f0f0dec",
"files": [],
"subMetas": {},
"userData": {}
}