From 97080d7380ca12f4e83135e00443b19ec41d4abc Mon Sep 17 00:00:00 2001 From: Dennis Postma Date: Sat, 21 Dec 2024 02:09:18 +0100 Subject: [PATCH] Better anim. timing --- src/components/game/character/partials/CharacterHair.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/game/character/partials/CharacterHair.vue b/src/components/game/character/partials/CharacterHair.vue index 4a5635a..b58a383 100644 --- a/src/components/game/character/partials/CharacterHair.vue +++ b/src/components/game/character/partials/CharacterHair.vue @@ -28,14 +28,12 @@ const texture = computed(() => { const isFlippedX = computed(() => [6, 4].includes(props.zoneCharacter.character.rotation ?? 0)) -const ANIMATION_MS = 250 // Animation duration in milliseconds const imageProps = computed(() => ({ depth: 1, originY: [0, 6].includes(props.zoneCharacter.character.rotation ?? 0) ? 4.33 : 5.33, flipX: isFlippedX.value, texture: texture.value, - y: props.zoneCharacter.isMoving ? (Math.floor((scene.time.now / ANIMATION_MS) % 2) === 0 ? -0.5 : 0) : 0, - // x: props.zoneCharacter.isMoving ? (Math.floor((scene.time.now / ANIMATION_MS) % 2) === 0 ? -1 : 0) : 0, + y: props.zoneCharacter.isMoving ? Math.floor(Date.now() / 250) % 2 : 0 })) loadSpriteTextures(scene, props.zoneCharacter.character.characterHair?.sprite as SpriteT)