feat(settings): block interactions while animation is happening
This commit is contained in:
@@ -85,6 +85,8 @@ const SLIDE_DURATION = 0.25;
|
||||
const ARROW_SLIDE_DELAY = 0.15;
|
||||
const ARROW_SLIDE_DURATION = 0.15;
|
||||
|
||||
const isAnimating = ref(true);
|
||||
|
||||
const animation = reactive({
|
||||
offsetY: SLIDE_OFFSET,
|
||||
opacity: 0,
|
||||
@@ -93,6 +95,7 @@ const animation = reactive({
|
||||
});
|
||||
|
||||
const animateIntro = async () => {
|
||||
isAnimating.value = true;
|
||||
await gsap
|
||||
.timeline()
|
||||
.to(animation, { offsetY: 0, duration: SLIDE_DURATION, ease: "none" }, 0)
|
||||
@@ -107,9 +110,11 @@ const animateIntro = async () => {
|
||||
{ downArrowOffsetY: 0, duration: ARROW_SLIDE_DURATION, ease: "none" },
|
||||
SLIDE_DURATION + ARROW_SLIDE_DELAY,
|
||||
);
|
||||
isAnimating.value = false;
|
||||
};
|
||||
|
||||
const animateOutro = async () => {
|
||||
isAnimating.value = true;
|
||||
await gsap
|
||||
.timeline()
|
||||
.to(
|
||||
@@ -208,7 +213,7 @@ onRender((ctx) => {
|
||||
}, 10);
|
||||
|
||||
useKeyDown((key) => {
|
||||
if (!props.selected || props.disabled) return;
|
||||
if (isAnimating.value || !props.selected || props.disabled) return;
|
||||
switch (key) {
|
||||
case "NDS_UP":
|
||||
increase();
|
||||
@@ -220,7 +225,7 @@ useKeyDown((key) => {
|
||||
});
|
||||
|
||||
onClick((x, y) => {
|
||||
if (props.disabled) return;
|
||||
if (isAnimating.value || props.disabled) return;
|
||||
if (
|
||||
rectContains(
|
||||
[props.x, Y, upImage.value.rect.width, ARROW_IMAGE_HEIGHT],
|
||||
|
||||
Reference in New Issue
Block a user