diff --git a/app/components/Common/ButtonSelector.vue b/app/components/Common/ButtonSelector.vue index 8a14fad..9fa0f92 100644 --- a/app/components/Common/ButtonSelector.vue +++ b/app/components/Common/ButtonSelector.vue @@ -14,12 +14,12 @@ const { onRender } = useScreen(); const app = useAppStore(); const { assets } = useAssets(); -const ANIMATION_SPEED = 0.25; +const ANIMATION_SPEED = 15; const CORNER_SIZE = 11; let [currentX, currentY, currentWidth, currentHeight] = props.rect; -onRender((ctx) => { +onRender((ctx, deltaTime) => { const [targetX, targetY, targetWidth, targetHeight] = props.rect; const dx = targetX - currentX; const dy = targetY - currentY; @@ -34,10 +34,11 @@ onRender((ctx) => { ) { [currentX, currentY, currentWidth, currentHeight] = props.rect; } else { - currentX += dx * ANIMATION_SPEED; - currentY += dy * ANIMATION_SPEED; - currentWidth += dw * ANIMATION_SPEED; - currentHeight += dh * ANIMATION_SPEED; + const speed = (ANIMATION_SPEED * deltaTime) / 1000; + currentX += dx * speed; + currentY += dy * speed; + currentWidth += dw * speed; + currentHeight += dh * speed; } const x = Math.floor(currentX);