1
0
forked from noxious/client

Timing for animations

This commit is contained in:
Dennis Postma 2024-12-20 21:29:33 +01:00
parent a926de8466
commit 1a3a53a229

View File

@ -28,17 +28,16 @@ const texture = computed(() => {
const isFlippedX = computed(() => [6, 4].includes(props.zoneCharacter.character.rotation ?? 0)) const isFlippedX = computed(() => [6, 4].includes(props.zoneCharacter.character.rotation ?? 0))
const ANIMATION_MS = 500 // Animation duration in milliseconds const ANIMATION_MS = 250 // Animation duration in milliseconds
const imageProps = computed(() => ({ const imageProps = computed(() => ({
depth: 1, depth: 1,
originY: [0, 6].includes(props.zoneCharacter.character.rotation ?? 0) ? 4.30 : 5.30, originY: [0, 6].includes(props.zoneCharacter.character.rotation ?? 0) ? 4.33 : 5.33,
flipX: isFlippedX.value, flipX: isFlippedX.value,
texture: texture.value, texture: texture.value,
y: props.zoneCharacter.isMoving ? (scene.time.now % ANIMATION_MS < (ANIMATION_MS / 2) ? 0.5 : -0.5) : 0, y: props.zoneCharacter.isMoving ? (Math.floor((scene.time.now / ANIMATION_MS) % 2) === 0 ? -0.5 : 0) : 0,
x: props.zoneCharacter.isMoving ? (scene.time.now % ANIMATION_MS < (ANIMATION_MS / 2) ? -0.5 : 0.5) : 0, // x: props.zoneCharacter.isMoving ? (Math.floor((scene.time.now / ANIMATION_MS) % 2) === 0 ? -1 : 0) : 0,
})) }))
loadSpriteTextures(scene, props.zoneCharacter.character.characterHair?.sprite as SpriteT) loadSpriteTextures(scene, props.zoneCharacter.character.characterHair?.sprite as SpriteT)
.then(() => {}) .then(() => {})
.catch((error) => { .catch((error) => {