update uwu

This commit is contained in:
2026-01-27 18:42:35 -05:00
parent 8c6b18c8a0
commit 66d7305690
3 changed files with 165 additions and 54 deletions

View File

@@ -1,20 +1,88 @@
<template>
<div class="uwu-floating">
</div>
<div class="caramel-wrapper">
<div class="caramel-stage">
<video class="caramel-video" autoplay loop playsinline muted preload="auto">
<source src="~/assets/caramelldansen.webm" type="video/webm" />
quick turn on video
</video>
<div class="caramel-float-anchor">
<video
ref="videoEl"
class="caramel-video"
autoplay
loop
muted
playsinline
preload="auto"
>
<source src="~/assets/caramelldansen.webm" type="video/webm" />
</video>
<button
class="audio-toggle"
@click="toggleAudio"
:aria-label="muted ? 'Unmute video' : 'Mute video'"
>
{{ muted ? '🔇' : '🔊' }}
</button>
<div
class="uwu-floating"
:data-pos="position"
>
:3
</div>
</div>
</div>
</div>
<div class="fixed bottom-4 right-6 opacity-40 text-xs select-none">
gimme.pet
</div>
</template>
</template>
<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount } from 'vue'
const videoEl = ref<HTMLVideoElement | null>(null)
const muted = ref(true)
function toggleAudio() {
if (!videoEl.value) return
muted.value = !muted.value
videoEl.value.muted = muted.value
if (!muted.value) {
videoEl.value.volume = 0.8
videoEl.value.play().catch(() => {})
}
}
const position = ref<'top' | 'bottom' | 'left' | 'right'>('top')
function updatePosition() {
const vw = window.innerWidth
const vh = window.innerHeight
// prioritize not colliding with short screens
if (vh < 520) {
position.value = 'bottom'
} else if (vw < 480) {
position.value = 'left'
} else if (vw > 1200) {
position.value = 'right'
} else {
position.value = 'top'
}
}
onMounted(() => {
if (videoEl.value) {
videoEl.value.muted = true
}
updatePosition()
window.addEventListener('resize', updatePosition)
})
onBeforeUnmount(() => {
window.removeEventListener('resize', updatePosition)
})
</script>