加分动画
This commit is contained in:
@@ -1,14 +1,44 @@
|
||||
import { config } from "../constants/config";
|
||||
import { AutoDestroy } from "./common/AutoDestroy";
|
||||
|
||||
const { regClass, property } = Laya;
|
||||
|
||||
@regClass()
|
||||
export class ScoreAdd extends Laya.Script {
|
||||
declare owner : Laya.Box;
|
||||
|
||||
//组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
||||
@property(Laya.Label)
|
||||
public label: Laya.Label
|
||||
|
||||
onAwake(): void {
|
||||
var offset = this.owner.getChildByName("offset")
|
||||
Laya.Tween.to(offset, {y:-200}, 1000, Laya.Ease.strongIn, null, 500)
|
||||
var Label = offset.getChildByName("Label")
|
||||
Laya.Tween.to(Label, {scaleX:1.5, scaleY:1.5}, 500)
|
||||
this.label.scaleX = 0
|
||||
this.label.skewY = 0
|
||||
|
||||
var d = this.owner.getComponent(AutoDestroy)
|
||||
d.lifeTime = 2
|
||||
}
|
||||
|
||||
onStart(): void {
|
||||
|
||||
var wait = 0
|
||||
|
||||
var duration = 300
|
||||
Laya.Tween.to(this.label, {scaleX: 1, scaleY: 1}, duration, Laya.Ease.strongIn, null, wait)
|
||||
wait += duration
|
||||
|
||||
duration = 300
|
||||
Laya.Tween.to(this.label, {y:-102}, duration, Laya.Ease.strongIn, null, wait)
|
||||
wait += duration
|
||||
|
||||
duration = 300
|
||||
Laya.Tween.to(this.label, {alpha:0}, duration, Laya.Ease.strongIn, null, wait)
|
||||
wait += duration
|
||||
|
||||
}
|
||||
|
||||
public onSetText(text: string): void {
|
||||
this.label.text = text
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user