添加按钮动画

This commit is contained in:
2025-05-28 16:54:04 +08:00
parent ce6e6a91d1
commit 6e850ff6a9
3 changed files with 128 additions and 54 deletions

View File

@@ -15,8 +15,9 @@
"_$type": "692a672b-2457-456c-8093-321ea7a10e1b", "_$type": "692a672b-2457-456c-8093-321ea7a10e1b",
"scriptPath": "../src/views/Stage.ts", "scriptPath": "../src/views/Stage.ts",
"btn_back": { "btn_back": {
"_$ref": "l1ebdt6a" "_$ref": "pg501bsr"
}, },
"btn_new": null,
"btn_pause": { "btn_pause": {
"_$ref": "qfuij2yw" "_$ref": "qfuij2yw"
}, },
@@ -71,19 +72,26 @@
"centerY": -868, "centerY": -868,
"_$child": [ "_$child": [
{ {
"_$id": "l1ebdt6a", "_$id": "pg501bsr",
"_$type": "Button", "_$type": "Box",
"name": "btn_back", "name": "btn_back",
"x": 17, "x": 17,
"width": 69, "width": 69,
"height": 48, "height": 48,
"_mouseState": 2, "_mouseState": 2,
"stateNum": 1, "_$child": [
"skin": "res://06a9c4a8-d664-4f3a-9c35-25b610195ced", {
"label": "", "_$id": "ij5lctcm",
"labelSize": 20, "_$type": "Image",
"labelAlign": "center", "name": "Image",
"labelVAlign": "middle" "width": 69,
"height": 48,
"mouseThrough": true,
"skin": "res://06a9c4a8-d664-4f3a-9c35-25b610195ced",
"useSourceSize": true,
"color": "#ffffff"
}
]
}, },
{ {
"_$id": "qfuij2yw", "_$id": "qfuij2yw",
@@ -40711,9 +40719,12 @@
"_$id": "zk4j4idj", "_$id": "zk4j4idj",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 5, "x": 58,
"y": 90,
"width": 106, "width": 106,
"height": 180, "height": 180,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {
@@ -40735,7 +40746,7 @@
] ]
}, },
{ {
"_$id": "fm5zezth", "_$id": "3zaraztw",
"_$type": "Box", "_$type": "Box",
"name": "Box(2)", "name": "Box(2)",
"x": 116, "x": 116,
@@ -40749,12 +40760,15 @@
], ],
"_$child": [ "_$child": [
{ {
"_$id": "eqh8to3f", "_$id": "rx7tbik5",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 5, "x": 58,
"y": 90,
"width": 106, "width": 106,
"height": 180, "height": 180,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {
@@ -40776,7 +40790,7 @@
] ]
}, },
{ {
"_$id": "6f0fymna", "_$id": "uovnq3uc",
"_$type": "Box", "_$type": "Box",
"name": "Box(3)", "name": "Box(3)",
"x": 232, "x": 232,
@@ -40790,12 +40804,15 @@
], ],
"_$child": [ "_$child": [
{ {
"_$id": "tkc0m4wv", "_$id": "fkr108uj",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 5, "x": 58,
"y": 90,
"width": 106, "width": 106,
"height": 180, "height": 180,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {
@@ -40819,7 +40836,7 @@
] ]
}, },
{ {
"_$id": "xnclf3a3", "_$id": "9xkv3fct",
"_$type": "HBox", "_$type": "HBox",
"name": "HBox(2)", "name": "HBox(2)",
"x": 348, "x": 348,
@@ -40829,7 +40846,7 @@
"align": "middle", "align": "middle",
"_$child": [ "_$child": [
{ {
"_$id": "gemp6p7e", "_$id": "0w6qin9b",
"_$type": "Box", "_$type": "Box",
"name": "Box(1)", "name": "Box(1)",
"width": 116, "width": 116,
@@ -40842,12 +40859,15 @@
], ],
"_$child": [ "_$child": [
{ {
"_$id": "8huxw24i", "_$id": "r3o7zdlu",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 5, "x": 58,
"y": 90,
"width": 106, "width": 106,
"height": 180, "height": 180,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {
@@ -40869,7 +40889,7 @@
] ]
}, },
{ {
"_$id": "zi978w4f", "_$id": "9p9wn5vx",
"_$type": "Box", "_$type": "Box",
"name": "Box(2)", "name": "Box(2)",
"x": 116, "x": 116,
@@ -40883,12 +40903,15 @@
], ],
"_$child": [ "_$child": [
{ {
"_$id": "6v4cayxm", "_$id": "d9a3erhd",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 5, "x": 58,
"y": 90,
"width": 106, "width": 106,
"height": 180, "height": 180,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {
@@ -40910,7 +40933,7 @@
] ]
}, },
{ {
"_$id": "65828bco", "_$id": "gv4vv6ih",
"_$type": "Box", "_$type": "Box",
"name": "Box(3)", "name": "Box(3)",
"x": 232, "x": 232,
@@ -40924,12 +40947,15 @@
], ],
"_$child": [ "_$child": [
{ {
"_$id": "gnkqz86r", "_$id": "2ma3mold",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 5, "x": 58,
"y": 90,
"width": 106, "width": 106,
"height": 180, "height": 180,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {
@@ -40953,7 +40979,7 @@
] ]
}, },
{ {
"_$id": "68gzxorb", "_$id": "woh11ufr",
"_$type": "HBox", "_$type": "HBox",
"name": "HBox(3)", "name": "HBox(3)",
"x": 696, "x": 696,
@@ -40963,7 +40989,7 @@
"align": "middle", "align": "middle",
"_$child": [ "_$child": [
{ {
"_$id": "be2sfui4", "_$id": "csfchuoz",
"_$type": "Box", "_$type": "Box",
"name": "Box(1)", "name": "Box(1)",
"width": 116, "width": 116,
@@ -40976,12 +41002,15 @@
], ],
"_$child": [ "_$child": [
{ {
"_$id": "wuu6qfba", "_$id": "fjjvbs6t",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 5, "x": 58,
"y": 90,
"width": 106, "width": 106,
"height": 180, "height": 180,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {
@@ -41003,7 +41032,7 @@
] ]
}, },
{ {
"_$id": "ppcwo8e1", "_$id": "04277jw2",
"_$type": "Box", "_$type": "Box",
"name": "Box(2)", "name": "Box(2)",
"x": 116, "x": 116,
@@ -41017,12 +41046,15 @@
], ],
"_$child": [ "_$child": [
{ {
"_$id": "lg7xakyi", "_$id": "2r1wu4bz",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 5, "x": 58,
"y": 90,
"width": 106, "width": 106,
"height": 180, "height": 180,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {
@@ -41044,7 +41076,7 @@
] ]
}, },
{ {
"_$id": "cqoj7k46", "_$id": "nisjmquc",
"_$type": "Box", "_$type": "Box",
"name": "Box(3)", "name": "Box(3)",
"x": 232, "x": 232,
@@ -41058,12 +41090,15 @@
], ],
"_$child": [ "_$child": [
{ {
"_$id": "er8n615b", "_$id": "vum4kfua",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 5, "x": 58,
"y": 90,
"width": 106, "width": 106,
"height": 180, "height": 180,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {

View File

@@ -40415,8 +40415,12 @@
"_$id": "t1mmv0rt", "_$id": "t1mmv0rt",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 144,
"y": 66,
"width": 288, "width": 288,
"height": 132, "height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {
@@ -40438,7 +40442,7 @@
] ]
}, },
{ {
"_$id": "7znqy9ij", "_$id": "a8kuqzi4",
"_$type": "Box", "_$type": "Box",
"name": "Box(2)", "name": "Box(2)",
"x": 312, "x": 312,
@@ -40452,11 +40456,15 @@
], ],
"_$child": [ "_$child": [
{ {
"_$id": "ra54qf6r", "_$id": "ydr15yze",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 144,
"y": 66,
"width": 288, "width": 288,
"height": 132, "height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {
@@ -40478,7 +40486,7 @@
] ]
}, },
{ {
"_$id": "k6cyaalm", "_$id": "c80yao58",
"_$type": "Box", "_$type": "Box",
"name": "Box(3)", "name": "Box(3)",
"x": 624, "x": 624,
@@ -40492,11 +40500,15 @@
], ],
"_$child": [ "_$child": [
{ {
"_$id": "eb6npfo3", "_$id": "p99q0kis",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 144,
"y": 66,
"width": 288, "width": 288,
"height": 132, "height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {
@@ -40520,7 +40532,7 @@
] ]
}, },
{ {
"_$id": "glifnfaz", "_$id": "2wpktyxw",
"_$type": "HBox", "_$type": "HBox",
"name": "HBox(2)", "name": "HBox(2)",
"y": 156, "y": 156,
@@ -40531,7 +40543,7 @@
"align": "middle", "align": "middle",
"_$child": [ "_$child": [
{ {
"_$id": "3e1a66h0", "_$id": "9ju53h5f",
"_$type": "Box", "_$type": "Box",
"name": "Box(1)", "name": "Box(1)",
"width": 288, "width": 288,
@@ -40544,11 +40556,15 @@
], ],
"_$child": [ "_$child": [
{ {
"_$id": "lg21qlwr", "_$id": "p1obdbpg",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 144,
"y": 66,
"width": 288, "width": 288,
"height": 132, "height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {
@@ -40570,7 +40586,7 @@
] ]
}, },
{ {
"_$id": "o3hf7j4k", "_$id": "2dj1yj0i",
"_$type": "Box", "_$type": "Box",
"name": "Box(2)", "name": "Box(2)",
"x": 312, "x": 312,
@@ -40584,11 +40600,15 @@
], ],
"_$child": [ "_$child": [
{ {
"_$id": "wz84kw4u", "_$id": "0c1acxli",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 144,
"y": 66,
"width": 288, "width": 288,
"height": 132, "height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {
@@ -40610,7 +40630,7 @@
] ]
}, },
{ {
"_$id": "bruxu316", "_$id": "ehp90nsg",
"_$type": "Box", "_$type": "Box",
"name": "Box(3)", "name": "Box(3)",
"x": 624, "x": 624,
@@ -40624,11 +40644,15 @@
], ],
"_$child": [ "_$child": [
{ {
"_$id": "33ghkerz", "_$id": "4wise89j",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 144,
"y": 66,
"width": 288, "width": 288,
"height": 132, "height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {
@@ -40652,7 +40676,7 @@
] ]
}, },
{ {
"_$id": "2xiaoiga", "_$id": "dqn77qh7",
"_$type": "HBox", "_$type": "HBox",
"name": "HBox(3)", "name": "HBox(3)",
"y": 312, "y": 312,
@@ -40663,7 +40687,7 @@
"align": "middle", "align": "middle",
"_$child": [ "_$child": [
{ {
"_$id": "n3d2l4ec", "_$id": "wfy581lp",
"_$type": "Box", "_$type": "Box",
"name": "Box(1)", "name": "Box(1)",
"width": 288, "width": 288,
@@ -40676,11 +40700,15 @@
], ],
"_$child": [ "_$child": [
{ {
"_$id": "0565kgao", "_$id": "6fni8dys",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 144,
"y": 66,
"width": 288, "width": 288,
"height": 132, "height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {
@@ -40702,7 +40730,7 @@
] ]
}, },
{ {
"_$id": "71bocvqc", "_$id": "yuy9dksg",
"_$type": "Box", "_$type": "Box",
"name": "Box(2)", "name": "Box(2)",
"x": 312, "x": 312,
@@ -40716,11 +40744,15 @@
], ],
"_$child": [ "_$child": [
{ {
"_$id": "kab0rerr", "_$id": "lhpdbsb2",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 144,
"y": 66,
"width": 288, "width": 288,
"height": 132, "height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {
@@ -40742,7 +40774,7 @@
] ]
}, },
{ {
"_$id": "3cw2thiu", "_$id": "sjxgfb9s",
"_$type": "Box", "_$type": "Box",
"name": "Box(3)", "name": "Box(3)",
"x": 624, "x": 624,
@@ -40756,11 +40788,15 @@
], ],
"_$child": [ "_$child": [
{ {
"_$id": "0ztbfnvx", "_$id": "j1km62o4",
"_$type": "Sprite", "_$type": "Sprite",
"name": "Sprite", "name": "Sprite",
"x": 144,
"y": 66,
"width": 288, "width": 288,
"height": 132, "height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true, "mouseThrough": true,
"_gcmds": [ "_gcmds": [
{ {

View File

@@ -506,6 +506,9 @@ export class Stage extends Laya.Script {
public onClickCandy(evt: Laya.Event): void { public onClickCandy(evt: Laya.Event): void {
var candy = evt.target.getComponent(Candy); var candy = evt.target.getComponent(Candy);
this.onApplyCandy(candy.get_show(), false) this.onApplyCandy(candy.get_show(), false)
var sp = evt.target.getChildByName("Sprite") as Laya.Sprite
Laya.Tween.to(sp, {scaleX: 0.9, scaleY: 0.9}, 100, Laya.Ease.linearIn)
Laya.Tween.to(sp, {scaleX: 1, scaleY: 1}, 100, Laya.Ease.linearInOut, null, 100)
} }
onKeyUp(evt: Laya.Event): void { onKeyUp(evt: Laya.Event): void {