diff --git a/src/components/Options.svelte b/src/components/Options.svelte index e50d170..e15a67b 100644 --- a/src/components/Options.svelte +++ b/src/components/Options.svelte @@ -60,6 +60,11 @@ label: 'main.options.use_dyslexic_font', click: toggle(store.dyslexicFont), }, + { + bind: store.animateLandscape, + label: 'Animated landscape', + click: toggle(store.animateLandscape), + }, { bind: store.allowDancing, label: 'main.options.allow_dancing_letters', diff --git a/src/components/landscape/Landscape.svelte b/src/components/landscape/Landscape.svelte index 5ab5f8e..1e55861 100644 --- a/src/components/landscape/Landscape.svelte +++ b/src/components/landscape/Landscape.svelte @@ -10,7 +10,7 @@ import { tick } from 'svelte' import { bezierEasing } from '$lib/transitions' - const { landscapeForceColor } = store + const { landscapeForceColor, animateLandscape } = store let initializing = true let svgElement: SVGElement @@ -84,9 +84,14 @@ if (currentRow === 0) { if (landscape.rowsGenerated > 0) clearLandscape() return - } else if (firstDraw || landscape.rowsGenerated > 0) { + } + if (firstDraw || landscape.rowsGenerated > 0) { firstDraw = false + animate = get(animateLandscape) + } + if (get(store.landscapeRedraw)) { animate = true + store.landscapeRedraw.set(false) } if (currentRow === landscape.rowsGenerated) return landscape = getLandscape( @@ -123,7 +128,6 @@ redraw++ clearLandscape() updateLandscape() - store.landscapeRedraw.set(false) }) // Hide landscape until it updates to avoid flashing on FF store.landscapeWideView.subscribe(() => (hide = true)) diff --git a/src/store/app.ts b/src/store/app.ts index b544fed..7d60524 100644 --- a/src/store/app.ts +++ b/src/store/app.ts @@ -25,6 +25,10 @@ export const keyboardLayout: Writable = storageWritable( ) export const dyslexicFont: Writable = storageWritable('wp-dyslexicFont', false) export const allowDancing: Writable = storageWritable('wp-allowDancing', true) +export const animateLandscape: Writable = storageWritable( + 'wp-animateLandscape', + true +) export const shareURL: Writable = storageWritable('wp-shareURL', true) export const shareTimes: Writable = storageWritable('wp-shareTimes', false) export const preciseTimes: Writable = storageWritable('wp-preciseTimes', false) diff --git a/src/store/validation.ts b/src/store/validation.ts index b2b376b..4f76e87 100644 --- a/src/store/validation.ts +++ b/src/store/validation.ts @@ -26,6 +26,7 @@ export function validateLocalStorage() { if (![true, false].includes(get(app.swapEnterBackspace))) app.swapEnterBackspace.set(false) if (![true, false].includes(get(app.dyslexicFont))) app.dyslexicFont.set(false) + if (![true, false].includes(get(app.animateLandscape))) app.animateLandscape.set(true) if (![true, false].includes(get(app.allowDancing))) app.allowDancing.set(true) if (![true, false].includes(get(app.shareURL))) app.shareURL.set(true) if (![true, false].includes(get(app.shareTimes))) app.shareTimes.set(false)