kaplay-ui 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +14 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -22,6 +22,17 @@ export const addTextButton = (
22
22
  txtSize = 15,
23
23
  hoverFx = true
24
24
  ) => {
25
+ // Shadow effect
26
+ const shadow = add([
27
+ rect(w, h, { radius: 8 }),
28
+ pos(x + 2, y + 2),
29
+ area(),
30
+ scale(1),
31
+ anchor("center"),
32
+ outline(1),
33
+ color(128, 128, 128),
34
+ ]);
35
+
25
36
  // Button
26
37
  const btn = add([
27
38
  rect(w, h, { radius: 8 }),
@@ -39,10 +50,11 @@ export const addTextButton = (
39
50
  // On click handler
40
51
  btn.onClick(onClick);
41
52
 
42
- btn.onHoverUpdate(() => {
53
+ btn.onHover(() => {
43
54
  setCursor("pointer");
44
55
  if (hoverFx) {
45
56
  btn.scale = vec2(1.03);
57
+ shadow.scale = vec2(1.03);
46
58
  }
47
59
  });
48
60
 
@@ -50,6 +62,7 @@ export const addTextButton = (
50
62
  setCursor("default");
51
63
  if (hoverFx) {
52
64
  btn.scale = vec2(1);
65
+ shadow.scale = vec2(1);
53
66
  }
54
67
  });
55
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kaplay-ui",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "UI components for KAPLAY",
5
5
  "main": "index.js",
6
6
  "repository": {