This commit is contained in:
parent
bbe310bc77
commit
74965d2b8c
@ -45,7 +45,7 @@ watch(
|
||||
() => props.digit,
|
||||
async (d) => {
|
||||
if (GAME_2048_DEBUG) {
|
||||
console.log('c1', linearLeave);
|
||||
console.log('c1', linearLeave, leaveDuration);
|
||||
}
|
||||
await div.value?.animate([{ transform: 'none' }, { transform: reversed ? down : up }], {
|
||||
easing: linearLeave ? 'linear' : 'ease-in',
|
||||
@ -56,7 +56,7 @@ watch(
|
||||
digit.value = d;
|
||||
emit('up', d);
|
||||
if (GAME_2048_DEBUG) {
|
||||
console.log('c2', linearEnter);
|
||||
console.log('c2', linearEnter, enterDuration);
|
||||
}
|
||||
await div.value?.animate([{ transform: reversed ? up : down }, { transform: 'none' }], {
|
||||
easing: linearEnter ? 'linear' : 'ease-out',
|
||||
|
@ -50,7 +50,7 @@
|
||||
}
|
||||
</style>
|
||||
<script lang="ts">
|
||||
export const baseDuration = (tileMoveDuration + tileShowDuration) / 2;
|
||||
export const baseDuration = (tileShowDuration + tileMoveDuration) / 2;
|
||||
const fadeOutKeyframe = { fontSize: 0, scale: 0 };
|
||||
</script>
|
||||
<script lang="ts" setup>
|
||||
@ -108,22 +108,18 @@ onMounted(async () => {
|
||||
score.value = s;
|
||||
const newDelta = s - old;
|
||||
reversed.value = newDelta < 0;
|
||||
linearEnter.value = !!scoreQueue.size && (delta >= 0 ? newDelta >= 0 : newDelta < 0);
|
||||
if (GAME_2048_DEBUG) {
|
||||
console.log('score', s);
|
||||
console.log(linearEnter.value);
|
||||
}
|
||||
delta = newDelta;
|
||||
leaveDuration.value = baseDuration / (scoreQueue.size + 1);
|
||||
enterDuration.value = baseDuration / (scoreQueue.size + 1 + Number(linearEnter.value));
|
||||
leaveDuration.value = baseDuration / (scoreQueue.size + 1 + Number(linearEnter.value));
|
||||
enterDuration.value = baseDuration / (scoreQueue.size + 1);
|
||||
futureMap.clear();
|
||||
if (!new RegExp(`.+${old}`).test(String(s))) {
|
||||
futureMap.add('leave');
|
||||
futureMap.add('leave').then(() => {
|
||||
linearEnter.value = !!scoreQueue.size && (delta >= 0 ? newDelta >= 0 : newDelta < 0);
|
||||
});
|
||||
}
|
||||
if (!new RegExp(`.+${s}$`).test(String(old))) {
|
||||
futureMap.add('enter');
|
||||
}
|
||||
await nextTick();
|
||||
await futureMap.waitAll();
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user