样式微调
All checks were successful
CI / build (push) Successful in 6m54s

This commit is contained in:
Jeffrey Hsu 2024-11-10 19:51:53 +08:00
parent 6cadcfacfc
commit 8eea255d13

View File

@ -1,23 +1,22 @@
<script lang="ts" setup> <script lang="ts" setup>
// 使 ref x y import {computed, ref} from "vue";
import {computed, reactive, ref} from "vue";
import {debounce, getAssetURL} from "@/utils/function.ts"; import {debounce, getAssetURL} from "@/utils/function.ts";
import SocialMediaWidget from "@/components/widget/SocialMediaWidget.vue"; import SocialMediaWidget from "@/components/widget/SocialMediaWidget.vue";
// 使 ref x y
const mouseX = ref(0) const mouseX = ref(0)
const mouseY = ref(0) const mouseY = ref(0)
// const card = ref<HTMLDivElement | null>(null) // const card = ref<HTMLDivElement | null>(null)
const rotation = reactive({ // const rotation = reactive({
rotateX: 0, // rotateX: 0,
rotateY: 0, // rotateY: 0,
}); // });
const typedString = ['Hello, Welcome to this site!^1000', '欢迎访问本网站!^1000'] const typedString = ['Hello, Welcome to this site!^1000', '欢迎访问本网站!^1000']
const littleWidget = [ const littleWidget = [
{ {
icon: ['fab', 'qq'], icon: ['fab', 'qq'],
url: "tencent://message/?uin=1922471905&Site=&Menu=yes", url: "https://qm.qq.com/q/9fhtO8JJt0",
title: "QQ", title: "QQ",
}, },
{ {
@ -36,12 +35,13 @@ const littleWidget = [
title: "Steam" title: "Steam"
} }
] ]
const characterUrl = getAssetURL('hoshino.png')
// //
const handleMouseMove = (event: MouseEvent) => { const handleMouseMove = (event: MouseEvent) => {
// //
mouseX.value = (event.clientX / window.innerWidth - 0.5) * 100 mouseX.value = -(event.clientX / window.innerWidth - 0.5) * 100
mouseY.value = (event.clientY / window.innerHeight - 0.5) * 100 mouseY.value = -(event.clientY / window.innerHeight - 0.5) * 100
} }
const debouncedMouseMove = debounce(handleMouseMove, 10) const debouncedMouseMove = debounce(handleMouseMove, 10)
@ -51,19 +51,17 @@ const backgroundStyle = computed(() => ({
backgroundPosition: `${mouseX.value}px ${mouseY.value}px`, backgroundPosition: `${mouseX.value}px ${mouseY.value}px`,
backgroundImage: `url(${getAssetURL('bg.png')})`, backgroundImage: `url(${getAssetURL('bg.png')})`,
backgroundSize: "150px", backgroundSize: "150px",
transition: 'background-position 0.1s',
backgroundAttachment: 'fixed'
})) }))
</script> </script>
<template> <template>
<div :style="backgroundStyle" <div :style="backgroundStyle"
class="relative flex h-screen w-full items-center justify-center bg-blue-400" class="relative flex h-screen w-full items-center justify-center bg-blue-400 bg-fixed"
@mousemove="debouncedMouseMove" @mousemove="debouncedMouseMove"
> >
<div ref="card" :style="{transform: `rotateX(${rotation.rotateX}deg) rotateY(${rotation.rotateY}deg)`}" <div class="relative mx-4 w-full rounded-xl bg-white p-8 transition-transform duration-300 min-h-96
class="mx-4 w-full rounded-xl bg-white p-8 transition-transform duration-300 min-h-96 md:mx-0 md:max-w-screen-md" md:mx-0 md:max-w-screen-md"
style="perspective: 1000px"> >
<p class="text-gray-500">你好欢迎来到</p> <p class="text-gray-500">你好欢迎来到</p>
<div class="relative mt-4 h-72 text-5xl text-blue-400 transition-all md:text-6xl lg:text-7xl"> <div class="relative mt-4 h-72 text-5xl text-blue-400 transition-all md:text-6xl lg:text-7xl">
<h1 style="font-family: BaconyScript,sans-serif">CantyOn_ion's</h1> <h1 style="font-family: BaconyScript,sans-serif">CantyOn_ion's</h1>
@ -99,7 +97,7 @@ const backgroundStyle = computed(() => ({
<div class="invisible absolute top-0 -right-6 -bottom-6 opacity-0 transition-all <div class="invisible absolute top-0 -right-6 -bottom-6 opacity-0 transition-all
sm:visible sm:opacity-100 lg:-top-28 lg:-right-28 lg:-bottom-10" sm:visible sm:opacity-100 lg:-top-28 lg:-right-28 lg:-bottom-10"
> >
<img :src="getAssetURL('hoshino.png')" alt="" class="float-right h-full" draggable="false"/> <img :src="characterUrl" alt="" class="float-right h-full" draggable="false"/>
</div> </div>
</div> </div>
<!-- 下箭头 --> <!-- 下箭头 -->