难度动画加速
This commit is contained in:
@@ -10,24 +10,29 @@ export class Difficulty extends Laya.Script {
|
||||
@property(Laya.Box)
|
||||
public obj_items: Laya.Box
|
||||
|
||||
private offset: Laya.Box
|
||||
// 组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
||||
onAwake(): void {
|
||||
const offset = this.owner.getChildByName("bottom").getChildByName("offset") as Laya.Box
|
||||
const bg = offset.getChildByName("bg") as Laya.Sprite
|
||||
bg.graphics.clear()
|
||||
bg.graphics.drawRoundRect(0, 0, offset.width, offset.height, 20, 20, 0, 0, "#f5f7fb")
|
||||
|
||||
offset.y = offset.width
|
||||
Laya.Tween.to(offset, { y: 0 }, 500)
|
||||
this.offset = this.owner.getChildByName("bottom").getChildByName("offset") as Laya.Box
|
||||
this.offset.y = this.offset.width
|
||||
|
||||
const bg = this.offset.getChildByName("bg") as Laya.Sprite
|
||||
bg.graphics.clear()
|
||||
bg.graphics.drawRoundRect(0, 0, this.offset.width, this.offset.height, 20, 20, 0, 0, "#f5f7fb")
|
||||
|
||||
const mask = this.owner.getChildByName("mask")
|
||||
mask.on(Laya.Event.CLICK, this, () => {
|
||||
Laya.Tween.to(offset, { y: 2400 }, 500, null, Laya.Handler.create(this, () => {
|
||||
Laya.Tween.to(this.offset, { y: 2400 }, 200, null, Laya.Handler.create(this, () => {
|
||||
this.owner.destroy()
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
onStart(): void {
|
||||
Laya.Tween.to(this.offset, { y: 0 }, 200)
|
||||
}
|
||||
|
||||
public onInit(callback: any): void {
|
||||
for (let i = 0; i < config.DIFFICULTY_LIST.length; i++) {
|
||||
const obj = this.obj_items.getChildAt(i)
|
||||
|
||||
Reference in New Issue
Block a user