66 <p class =" section-desc" >感谢所有为社区做出贡献的开发者、捐赠者、以及运营和维护人员</p >
77 </div >
88
9- <div
9+ <HoverCard
1010 ref =" cardRef"
1111 class =" contributors-card"
12- :style =" cardTransformStyle"
13- @mouseenter =" onMouseEnter"
14- @mouseleave =" onMouseLeave"
15- @mousemove =" onMouseMove"
1612 >
1713 <div class =" card-glow" ></div >
1814 <div class =" card-border" ></div >
19- <img
20- :src =" imageUrl"
15+ <img
16+ :src =" imageUrl"
2117 alt =" Community Contributors"
2218 class =" contributors-image"
2319 loading =" lazy"
2420 />
25- </div >
21+ </HoverCard >
2622 </section >
2723</template >
2824
2925<script setup lang="ts">
30- import { ref , computed } from ' vue'
26+ import HoverCard from " ./UI/HoverCard. vue"
3127
32- const props = defineProps <{
28+ defineProps <{
3329 imageUrl: string
3430}>()
35-
36- const cardRef = ref <HTMLElement | null >(null )
37- const isHovered = ref (false )
38- const mouseX = ref (0 )
39- const mouseY = ref (0 )
40-
41- // 3D 重力卡片变换效果
42- const cardTransformStyle = computed (() => {
43- if (! isHovered .value ) {
44- return {
45- transform: ' perspective(1200px) rotateX(0deg) rotateY(0deg) translateZ(0px)' ,
46- transition: ' transform 0.5s cubic-bezier(0.23, 1, 0.32, 1)'
47- }
48- }
49-
50- const rotateX = mouseY .value * - 10
51- const rotateY = mouseX .value * 10
52- const translateZ = 20
53-
54- return {
55- transform: ` perspective(1200px) rotateX(${rotateX }deg) rotateY(${rotateY }deg) translateZ(${translateZ }px) ` ,
56- transition: ' transform 0.1s ease-out'
57- }
58- })
59-
60- const onMouseEnter = () => {
61- isHovered .value = true
62- }
63-
64- const onMouseLeave = () => {
65- isHovered .value = false
66- mouseX .value = 0
67- mouseY .value = 0
68- }
69-
70- const onMouseMove = (event : MouseEvent ) => {
71- if (! cardRef .value ) return
72-
73- const rect = cardRef .value .getBoundingClientRect ()
74- mouseX .value = (event .clientX - rect .left - rect .width / 2 ) / (rect .width / 2 )
75- mouseY .value = (event .clientY - rect .top - rect .height / 2 ) / (rect .height / 2 )
76- }
7731 </script >
7832
7933<style scoped>
@@ -92,7 +46,7 @@ const onMouseMove = (event: MouseEvent) => {
9246 display : inline-flex ;
9347 align-items : center ;
9448 gap : 8px ;
95- padding : 6px 12 px ;
49+ padding : 6px 14 px ;
9650 border-radius : 999px ;
9751 background : rgba (var (--vp-c-brand-1-rgb , 66 , 184 , 131 ), 0.12 );
9852 color : var (--vp-c-brand-1 );
@@ -127,14 +81,14 @@ const onMouseMove = (event: MouseEvent) => {
12781 transform-style : preserve-3d ;
12882 cursor : pointer ;
12983 background : var (--vp-c-bg-soft );
130- box-shadow :
84+ box-shadow :
13185 0 10px 40px rgba (0 , 0 , 0 , 0.12 ),
13286 0 2px 8px rgba (0 , 0 , 0 , 0.08 );
13387 transition : box-shadow 0.3s ease ;
13488}
13589
13690.contributors-card :hover {
137- box-shadow :
91+ box-shadow :
13892 0 20px 60px rgba (0 , 0 , 0 , 0.18 ),
13993 0 4px 16px rgba (0 , 0 , 0 , 0.12 );
14094}
@@ -143,18 +97,18 @@ const onMouseMove = (event: MouseEvent) => {
14397 position : absolute ;
14498 inset : -2px ;
14599 background : radial-gradient (
146- circle at 20% 30% ,
147- rgba (66 , 184 , 131 , 0.3 ),
100+ circle at 20% 30% ,
101+ rgba (66 , 184 , 131 , 0.3 ),
148102 transparent 50%
149103 ),
150104 radial-gradient (
151- circle at 80% 70% ,
152- rgba (52 , 168 , 250 , 0.3 ),
105+ circle at 80% 70% ,
106+ rgba (52 , 168 , 250 , 0.3 ),
153107 transparent 50%
154108 ),
155109 linear-gradient (
156- 135deg ,
157- rgba (66 , 184 , 131 , 0.25 ),
110+ 135deg ,
111+ rgba (66 , 184 , 131 , 0.25 ),
158112 rgba (159 , 122 , 234 , 0.25 )
159113 );
160114 opacity : 0 ;
@@ -174,12 +128,12 @@ const onMouseMove = (event: MouseEvent) => {
174128 border-radius : 20px ;
175129 border : 2px solid transparent ;
176130 background : linear-gradient (
177- 135deg ,
178- rgba (66 , 184 , 131 , 0.4 ),
131+ 135deg ,
132+ rgba (66 , 184 , 131 , 0.4 ),
179133 rgba (52 , 168 , 250 , 0.4 )
180134 ) border-box ;
181- -webkit-mask :
182- linear-gradient (#fff 0 0 ) padding-box ,
135+ -webkit-mask :
136+ linear-gradient (#fff 0 0 ) padding-box ,
183137 linear-gradient (#fff 0 0 );
184138 -webkit-mask-composite : xor;
185139 mask-composite : exclude ;
0 commit comments