diff --git a/src/components/functions.js b/src/components/functions.js index e82e834..0515d46 100644 --- a/src/components/functions.js +++ b/src/components/functions.js @@ -36,7 +36,7 @@ export function functionComponent(k) { functionButton(k, 190, 598); } -function functionButton(k, x, y, textInput) { +function functionButton(k, x, y, textInput, onClick) { const button = k.add([ k.rect(56, 28, { radius: 3 @@ -44,7 +44,9 @@ function functionButton(k, x, y, textInput) { k.pos(x, y), k.color(10,10,10), k.anchor("top"), - ]) + k.area(), + k.scale(1) + ]); const text = k.add([ k.text(textInput, { @@ -55,6 +57,17 @@ function functionButton(k, x, y, textInput) { }), k.pos(x, y + 5), k.color(255,255,255), - k.anchor("top") - ]) + k.anchor("top"), + k.scale(1) + ]); + + button.onClick(() => { + button.scaleTo(0.95); + text.scaleTo(0.95); + setTimeout(() => { + button.scaleTo(1); + text.scaleTo(1); + if (onClick) onClick(); // Run the callback function if it's provided + }, 100); + }); } diff --git a/src/scenes/fms.js b/src/scenes/fms.js index 08d2994..4f7b6e4 100644 --- a/src/scenes/fms.js +++ b/src/scenes/fms.js @@ -10,8 +10,8 @@ export default function FMS(k) { size: 18, width: 500 }), - k.pos(300, 5), - k.color(0,0,0), + k.pos(300, 910), + k.color(125,125,125), k.anchor("top") ]);