难度动画加速

This commit is contained in:
2025-06-13 17:53:18 +08:00
parent 9a06f15db5
commit 5968ad0b48
2 changed files with 27 additions and 67 deletions

View File

@@ -3,8 +3,8 @@
"_$id": "zala0uui",
"_$type": "Box",
"name": "Difficulty",
"width": 1920,
"height": 1080,
"width": 1080,
"height": 1920,
"_mouseState": 2,
"left": 0,
"right": 0,
@@ -24,8 +24,8 @@
"_$id": "4udntov4",
"_$type": "Image",
"name": "mask",
"width": 1920,
"height": 1080,
"width": 1080,
"height": 1920,
"alpha": 0.4,
"left": 0,
"right": 0,
@@ -38,8 +38,8 @@
"_$id": "8qh18emh",
"_$type": "Box",
"name": "bottom",
"y": -135,
"width": 1920,
"y": 705,
"width": 1080,
"height": 1215,
"left": 0,
"right": 0,
@@ -49,12 +49,13 @@
"_$id": "jzxgx41i",
"_$type": "Box",
"name": "offset",
"width": 1920,
"y": 2400,
"width": 1080,
"height": 1215,
"_mouseState": 2,
"left": 0,
"right": 0,
"bottom": 0,
"bottom": -2400,
"_$child": [
{
"_$id": "bd1s5tvm",
@@ -65,15 +66,10 @@
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 48,
"rt": 48,
"lb": 0,
"rb": 0,
"percent": true,
"lineWidth": 1,
"fillColor": "rgba(245, 247, 251, 1)"
}
@@ -83,7 +79,7 @@
"_$id": "e5l16p86",
"_$type": "Label",
"name": "Label",
"x": 510,
"x": 90,
"y": 35,
"width": 900,
"height": 180,
@@ -94,7 +90,6 @@
"color": "rgba(45, 49, 56, 1)",
"align": "center",
"valign": "middle",
"padding": "0,0,0,0",
"_$child": [
{
"_$id": "5xwrtg57",
@@ -116,15 +111,6 @@
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 6,
"rt": 6,
"lb": 6,
"rb": 6,
"percent": true,
"lineWidth": 1,
"fillColor": "rgba(211, 213, 219, 1)"
}
@@ -138,7 +124,6 @@
"_$id": "34t1dkio",
"_$type": "VBox",
"name": "items",
"x": 420,
"y": 288,
"width": 1080,
"height": 840,
@@ -179,15 +164,10 @@
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 36,
"rt": 36,
"lb": 36,
"rb": 36,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
@@ -206,8 +186,7 @@
"fontSize": 54,
"color": "rgba(45, 49, 56, 1)",
"align": "center",
"valign": "middle",
"padding": "0,0,0,0"
"valign": "middle"
}
]
},
@@ -243,15 +222,10 @@
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 36,
"rt": 36,
"lb": 36,
"rb": 36,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
@@ -270,8 +244,7 @@
"fontSize": 54,
"color": "rgba(45, 49, 56, 1)",
"align": "center",
"valign": "middle",
"padding": "0,0,0,0"
"valign": "middle"
}
]
},
@@ -307,15 +280,10 @@
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 36,
"rt": 36,
"lb": 36,
"rb": 36,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
@@ -334,8 +302,7 @@
"fontSize": 54,
"color": "rgba(45, 49, 56, 1)",
"align": "center",
"valign": "middle",
"padding": "0,0,0,0"
"valign": "middle"
}
]
},
@@ -371,15 +338,10 @@
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 36,
"rt": 36,
"lb": 36,
"rb": 36,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
@@ -398,8 +360,7 @@
"fontSize": 54,
"color": "rgba(45, 49, 56, 1)",
"align": "center",
"valign": "middle",
"padding": "0,0,0,0"
"valign": "middle"
}
]
},
@@ -435,15 +396,10 @@
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 36,
"rt": 36,
"lb": 36,
"rb": 36,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
@@ -462,8 +418,7 @@
"fontSize": 54,
"color": "rgba(45, 49, 56, 1)",
"align": "center",
"valign": "middle",
"padding": "0,0,0,0"
"valign": "middle"
}
]
}

View File

@@ -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)