From ef84a39c64231a178d8507e860a300a7163e49f5 Mon Sep 17 00:00:00 2001 From: David Haz Date: Fri, 25 Jul 2025 17:29:20 +0300 Subject: [PATCH] fix: clean up code formatting and improve hover effect styling --- .../TextAnimations/variableProximityCode.ts | 2 +- .../Components/BounceCards/BounceCards.vue | 39 ++++++++++++++----- .../Components/MagicBento/MagicBento.vue | 2 +- .../VariableProximity/VariableProximity.vue | 32 +++++++-------- src/demo/Components/BounceCardsDemo.vue | 36 +++++------------ .../TextAnimations/VariableProximityDemo.vue | 14 ++----- 6 files changed, 59 insertions(+), 66 deletions(-) diff --git a/src/constants/code/TextAnimations/variableProximityCode.ts b/src/constants/code/TextAnimations/variableProximityCode.ts index 18418cc..1213e00 100644 --- a/src/constants/code/TextAnimations/variableProximityCode.ts +++ b/src/constants/code/TextAnimations/variableProximityCode.ts @@ -23,4 +23,4 @@ export const variableProximity = createCodeObject(code, 'TextAnimations/Variable const containerRef = ref(null); ` -}); \ No newline at end of file +}); diff --git a/src/content/Components/BounceCards/BounceCards.vue b/src/content/Components/BounceCards/BounceCards.vue index 9569304..b5e3d47 100644 --- a/src/content/Components/BounceCards/BounceCards.vue +++ b/src/content/Components/BounceCards/BounceCards.vue @@ -10,17 +10,15 @@ v-for="(src, idx) in images" :key="idx" ref="cardRefs" - class="absolute w-[200px] aspect-square border-[5px] border-white rounded-[25px] overflow-hidden shadow-[0_4px_10px_rgba(0,0,0,0.2)] bg-[#f8f9fa] opacity-0" + class="absolute w-[200px] aspect-square border-[5px] border-white rounded-[25px] overflow-hidden shadow-[0_4px_10px_rgba(0,0,0,0.2)] bg-[#0b0b0b] opacity-0" :style="{ transform: transformStyles[idx] ?? 'none' }" @mouseenter="() => pushSiblings(idx)" @mouseleave="resetSiblings" > -
-
-
+
{ }; onMounted(playEntranceAnimation); -watch(() => props.images, async () => { - await nextTick(); - gsap.set(cardRefs.value, { opacity: 0, scale: 0 }); - playEntranceAnimation(); -}); +watch( + () => props.images, + async () => { + await nextTick(); + gsap.set(cardRefs.value, { opacity: 0, scale: 0 }); + playEntranceAnimation(); + } +); onUnmounted(() => { gsap.killTweensOf(cardRefs.value); }); + + diff --git a/src/content/Components/MagicBento/MagicBento.vue b/src/content/Components/MagicBento/MagicBento.vue index 17be7cb..6705de3 100644 --- a/src/content/Components/MagicBento/MagicBento.vue +++ b/src/content/Components/MagicBento/MagicBento.vue @@ -378,7 +378,7 @@ const ParticleCard = defineComponent({ const GlobalSpotlight = defineComponent({ name: 'GlobalSpotlight', props: { - gridRef: {type: [Object, null] as PropType, required: true}, + gridRef: { type: [Object, null] as PropType, required: true }, disableAnimations: { type: Boolean, default: false }, enabled: { type: Boolean, default: true }, spotlightRadius: { type: Number, default: DEFAULT_SPOTLIGHT_RADIUS }, diff --git a/src/content/TextAnimations/VariableProximity/VariableProximity.vue b/src/content/TextAnimations/VariableProximity/VariableProximity.vue index ad14c4f..7a9a642 100644 --- a/src/content/TextAnimations/VariableProximity/VariableProximity.vue +++ b/src/content/TextAnimations/VariableProximity/VariableProximity.vue @@ -26,12 +26,11 @@ > {{ letter }} -   +   + + + {{ props.label }} - {{ props.label }} @@ -57,7 +56,7 @@ const props = withDefaults(defineProps(), { falloff: 'linear', className: '', style: () => ({}), - onClick: undefined, + onClick: undefined }); const rootRef = ref(null); @@ -90,7 +89,7 @@ const parsedSettings = computed(() => { return Array.from(fromSettings.entries()).map(([axis, fromValue]) => ({ axis, fromValue, - toValue: toSettings.get(axis) ?? fromValue, + toValue: toSettings.get(axis) ?? fromValue })); }); @@ -100,15 +99,17 @@ const calculateDistance = (x1: number, y1: number, x2: number, y2: number) => const calculateFalloff = (distance: number) => { const norm = Math.min(Math.max(1 - distance / props.radius, 0), 1); switch (props.falloff) { - case 'exponential': return norm ** 2; - case 'gaussian': return Math.exp(-((distance / (props.radius / 2)) ** 2) / 2); + case 'exponential': + return norm ** 2; + case 'gaussian': + return Math.exp(-((distance / (props.radius / 2)) ** 2) / 2); case 'linear': - default: return norm; + default: + return norm; } }; -const getLetterKey = (wordIndex: number, letterIndex: number) => - `${wordIndex}-${letterIndex}`; +const getLetterKey = (wordIndex: number, letterIndex: number) => `${wordIndex}-${letterIndex}`; const getGlobalLetterIndex = (wordIndex: number, letterIndex: number) => { let globalIndex = 0; @@ -175,12 +176,7 @@ const animationLoop = () => { const letterCenterX = rect.left + rect.width / 2 - containerRect.left; const letterCenterY = rect.top + rect.height / 2 - containerRect.top; - const distance = calculateDistance( - mousePosition.value.x, - mousePosition.value.y, - letterCenterX, - letterCenterY - ); + const distance = calculateDistance(mousePosition.value.x, mousePosition.value.y, letterCenterX, letterCenterY); if (distance >= props.radius) { return; diff --git a/src/demo/Components/BounceCardsDemo.vue b/src/demo/Components/BounceCardsDemo.vue index c9dfd83..ea1b875 100644 --- a/src/demo/Components/BounceCardsDemo.vue +++ b/src/demo/Components/BounceCardsDemo.vue @@ -1,4 +1,3 @@ -