26
26
>
27
27
{{ letter }}
28
28
</span >
29
- <span
30
- v-if = " wordIndex < words.length - 1 "
31
- class =" inline-block "
32
- > & nbsp ; </ span >
29
+ <span v-if = " wordIndex < words.length - 1 " class = " inline-block " > & nbsp ; </ span >
30
+ </ span >
31
+ < span class =" absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap clip-rect-0 border-0 " >
32
+ {{ props.label }}
33
33
</span >
34
- <span class =" absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap clip-rect-0 border-0" >{{ props.label }}</span >
35
34
</span >
36
35
</template >
37
36
@@ -57,7 +56,7 @@ const props = withDefaults(defineProps<VariableProximityProps>(), {
57
56
falloff: ' linear' ,
58
57
className: ' ' ,
59
58
style : () => ({}),
60
- onClick: undefined ,
59
+ onClick: undefined
61
60
});
62
61
63
62
const rootRef = ref <HTMLElement | null >(null );
@@ -90,7 +89,7 @@ const parsedSettings = computed(() => {
90
89
return Array .from (fromSettings .entries ()).map (([axis , fromValue ]) => ({
91
90
axis ,
92
91
fromValue ,
93
- toValue: toSettings .get (axis ) ?? fromValue ,
92
+ toValue: toSettings .get (axis ) ?? fromValue
94
93
}));
95
94
});
96
95
@@ -100,15 +99,17 @@ const calculateDistance = (x1: number, y1: number, x2: number, y2: number) =>
100
99
const calculateFalloff = (distance : number ) => {
101
100
const norm = Math .min (Math .max (1 - distance / props .radius , 0 ), 1 );
102
101
switch (props .falloff ) {
103
- case ' exponential' : return norm ** 2 ;
104
- case ' gaussian' : return Math .exp (- ((distance / (props .radius / 2 )) ** 2 ) / 2 );
102
+ case ' exponential' :
103
+ return norm ** 2 ;
104
+ case ' gaussian' :
105
+ return Math .exp (- ((distance / (props .radius / 2 )) ** 2 ) / 2 );
105
106
case ' linear' :
106
- default : return norm ;
107
+ default :
108
+ return norm ;
107
109
}
108
110
};
109
111
110
- const getLetterKey = (wordIndex : number , letterIndex : number ) =>
111
- ` ${wordIndex }-${letterIndex } ` ;
112
+ const getLetterKey = (wordIndex : number , letterIndex : number ) => ` ${wordIndex }-${letterIndex } ` ;
112
113
113
114
const getGlobalLetterIndex = (wordIndex : number , letterIndex : number ) => {
114
115
let globalIndex = 0 ;
@@ -175,12 +176,7 @@ const animationLoop = () => {
175
176
const letterCenterX = rect .left + rect .width / 2 - containerRect .left ;
176
177
const letterCenterY = rect .top + rect .height / 2 - containerRect .top ;
177
178
178
- const distance = calculateDistance (
179
- mousePosition .value .x ,
180
- mousePosition .value .y ,
181
- letterCenterX ,
182
- letterCenterY
183
- );
179
+ const distance = calculateDistance (mousePosition .value .x , mousePosition .value .y , letterCenterX , letterCenterY );
184
180
185
181
if (distance >= props .radius ) {
186
182
return ;
0 commit comments