2025-06-10 18:24:50 +08:00
|
|
|
import BezierEasing from "bezier-easing"
|
|
|
|
|
import { Utility_EaseOut } from "../utils/utility"
|
2025-05-28 18:47:51 +08:00
|
|
|
import { AutoDestroy } from "./common/AutoDestroy"
|
2025-05-27 14:59:33 +08:00
|
|
|
|
2025-05-28 18:47:51 +08:00
|
|
|
const { regClass, property } = Laya
|
2025-05-15 21:36:03 +08:00
|
|
|
|
|
|
|
|
@regClass()
|
|
|
|
|
export class ScoreAdd extends Laya.Script {
|
2025-05-28 18:47:51 +08:00
|
|
|
declare owner: Laya.Box
|
2025-05-15 21:36:03 +08:00
|
|
|
|
2025-06-09 21:17:53 +08:00
|
|
|
@property(Laya.Label)
|
|
|
|
|
public shadow: Laya.Label
|
|
|
|
|
|
2025-05-28 18:47:51 +08:00
|
|
|
@property(Laya.Label)
|
|
|
|
|
public label: Laya.Label
|
2025-05-27 14:59:33 +08:00
|
|
|
|
2025-05-28 18:47:51 +08:00
|
|
|
onAwake(): void {
|
2025-06-09 21:17:53 +08:00
|
|
|
this.shadow.scaleX = 0
|
|
|
|
|
this.shadow.scaleY = 0
|
2025-05-28 18:47:51 +08:00
|
|
|
this.label.scaleX = 0
|
2025-06-04 20:15:38 +08:00
|
|
|
this.label.scaleY = 0
|
2025-05-27 14:59:33 +08:00
|
|
|
|
2025-05-28 18:47:51 +08:00
|
|
|
const d = this.owner.getComponent(AutoDestroy)
|
|
|
|
|
d.lifeTime = 2
|
|
|
|
|
}
|
2025-05-27 14:59:33 +08:00
|
|
|
|
2025-05-28 18:47:51 +08:00
|
|
|
onStart(): void {
|
2025-06-06 14:33:22 +08:00
|
|
|
// const filter: Laya.GlowFilter = new Laya.GlowFilter("#000000", 5, 0, 0);
|
|
|
|
|
// this.label.filters = [filter];
|
2025-06-10 18:24:50 +08:00
|
|
|
|
2025-06-06 14:33:22 +08:00
|
|
|
function bezierEaseLaya1(t: number, b: number, c: number, d: number) {
|
|
|
|
|
const bezier = BezierEasing(0.55, 1.8, 0.8, 0.95)
|
|
|
|
|
const p = bezier(t / d)
|
|
|
|
|
return c * p + b
|
|
|
|
|
}
|
2025-06-09 21:17:53 +08:00
|
|
|
Laya.Tween.to(this.shadow, { scaleX: 1, scaleY: 1 }, 300, bezierEaseLaya1, null, 0)
|
2025-06-06 14:33:22 +08:00
|
|
|
Laya.Tween.to(this.label, { scaleX: 1, scaleY: 1 }, 300, bezierEaseLaya1, null, 0)
|
|
|
|
|
|
2025-06-09 21:17:53 +08:00
|
|
|
Laya.Tween.to(this.shadow, { y: -102 }, 300, Utility_EaseOut, null, 500)
|
2025-06-06 16:05:54 +08:00
|
|
|
Laya.Tween.to(this.label, { y: -102 }, 300, Utility_EaseOut, null, 500)
|
2025-06-09 21:17:53 +08:00
|
|
|
|
|
|
|
|
Laya.Tween.to(this.shadow, { alpha: 0 }, 300, Utility_EaseOut, null, 500)
|
2025-06-06 16:05:54 +08:00
|
|
|
Laya.Tween.to(this.label, { alpha: 0 }, 300, Utility_EaseOut, null, 500)
|
2025-06-06 14:33:22 +08:00
|
|
|
|
|
|
|
|
// Laya.Tween.to(this.label, { scaleX: 1, scaleY: 1 }, 300, Laya.Ease.bounceIn, null, 0)
|
|
|
|
|
// Laya.Tween.to(this.label, { y: -102 }, 300, Laya.Ease.linearOut, null, 500)
|
|
|
|
|
// Laya.Tween.to(this.label, { alpha: 0 }, 300, Laya.Ease.linearOut, null, 500)
|
2025-05-28 18:47:51 +08:00
|
|
|
}
|
2025-05-27 14:59:33 +08:00
|
|
|
|
2025-05-28 18:47:51 +08:00
|
|
|
public onSetText(text: string): void {
|
|
|
|
|
this.label.text = text
|
|
|
|
|
}
|
|
|
|
|
}
|