Skip to content

Commit

Permalink
🐛 Fix dancing letters on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
vegeta897 committed Nov 27, 2024
1 parent e9cf916 commit 52ea094
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/components/Board.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,11 @@
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div
class="dance-tile"
style:opacity={((t < danceClickProgress ? 1 : 0) *
danceClickProgress) /
5}
style:opacity={danceClickProgress / 5 || 1}
on:click={() => danceClick(t)}
out:fade={{ duration: 500 }}
>
{'DANCE'[t]}
{'DANCE'.substring(0, danceClickProgress)[t] || ''}
</div>
{/if}
{#if idle && tile.letter === '' && r > $currentRow}
Expand Down
8 changes: 4 additions & 4 deletions src/components/Idler.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
const performAnimation = async (
animation: MultipartAnimation,
endDelay = 0,
iterations = 1,
fill: FillMode = 'forwards'
iterations = 1
): Promise<void> => {
await Promise.all(
AnimationParts.map(async (part) => {
Expand All @@ -36,9 +35,10 @@
await element.animate(animation[part]!, {
duration: animation.duration,
iterations,
endDelay,
fill,
fill: 'forwards',
}).finished
// Using the animation API's endDelay causes flickering on iOS, so we sleep instead
await sleep(endDelay)
}
})
)
Expand Down
2 changes: 0 additions & 2 deletions src/lib/transitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ export const bezierEasing = {

// Based on https://codepen.io/danwilson/pen/xGBKVq
export const animationSupported = (): boolean => {
// Unfortunately we can't risk having Chrome iOS's flickering animation bugs
if (navigator.userAgent.match('iPhone.*CriOS')) return false
const element = document.createElement('a')
document.body.appendChild(element)
if (!element.animate) return false
Expand Down

0 comments on commit 52ea094

Please sign in to comment.