1
0
forked from noxious/client

npm run format

This commit is contained in:
Dennis Postma 2024-11-05 23:16:47 +01:00
parent d71f4e7b59
commit 1384f50406
3 changed files with 8 additions and 19 deletions

View File

@ -102,13 +102,13 @@ const calculateLightStrength = (time: Date): number => {
} }
// Sunrise transition (6 AM - 7 AM) // Sunrise transition (6 AM - 7 AM)
else if (hour === SUNRISE_HOUR) { else if (hour === SUNRISE_HOUR) {
strength = NIGHT_STRENGTH + ((DAY_STRENGTH - NIGHT_STRENGTH) * minute / 60) strength = NIGHT_STRENGTH + ((DAY_STRENGTH - NIGHT_STRENGTH) * minute) / 60
} }
// Sunset transition (8 PM - 10 PM) // Sunset transition (8 PM - 10 PM)
else if (hour >= SUNSET_HOUR - 2 && hour < SUNSET_HOUR) { else if (hour >= SUNSET_HOUR - 2 && hour < SUNSET_HOUR) {
const totalMinutes = ((hour - (SUNSET_HOUR - 2)) * 60) + minute const totalMinutes = (hour - (SUNSET_HOUR - 2)) * 60 + minute
const transitionProgress = totalMinutes / 120 // 2 hours = 120 minutes const transitionProgress = totalMinutes / 120 // 2 hours = 120 minutes
strength = DAY_STRENGTH - ((DAY_STRENGTH - NIGHT_STRENGTH) * transitionProgress) strength = DAY_STRENGTH - (DAY_STRENGTH - NIGHT_STRENGTH) * transitionProgress
} }
return strength return strength

View File

@ -1,13 +1,6 @@
<template> <template>
<div style="display: none"> <div style="display: none">
<img <img v-for="(url, index) in imageUrls" :key="index" :src="url" alt="" @load="handleImageLoad(index)" @error="handleImageError(index)" />
v-for="(url, index) in imageUrls"
:key="index"
:src="url"
alt=""
@load="handleImageLoad(index)"
@error="handleImageError(index)"
/>
</div> </div>
</template> </template>
@ -15,11 +8,7 @@
import { ref } from 'vue' import { ref } from 'vue'
// Internal array of images to preload // Internal array of images to preload
const imageUrls = ref<string[]>([ const imageUrls = ref<string[]>(['/assets/ui-elements/ui-border-4-corners.svg', '/assets/ui-elements/ui-border-4-corners-light.svg', '/assets/ui-elements/ui-border-4-corners-small.svg'])
'/assets/ui-elements/ui-border-4-corners.svg',
'/assets/ui-elements/ui-border-4-corners-light.svg',
'/assets/ui-elements/ui-border-4-corners-small.svg'
])
const loadedImages = ref<Set<number>>(new Set()) const loadedImages = ref<Set<number>>(new Set())