diff --git a/src/constants/code/Backgrounds/gridMotionCode.ts b/src/constants/code/Backgrounds/gridMotionCode.ts index 0203dc9..0a7cfbb 100644 --- a/src/constants/code/Backgrounds/gridMotionCode.ts +++ b/src/constants/code/Backgrounds/gridMotionCode.ts @@ -6,40 +6,16 @@ export const gridMotion: CodeObject = { installation: `npm i gsap`, usage: ` `, code, }; diff --git a/src/content/Backgrounds/GridMotion/GridMotion.vue b/src/content/Backgrounds/GridMotion/GridMotion.vue index 4740bca..ec6bf4f 100644 --- a/src/content/Backgrounds/GridMotion/GridMotion.vue +++ b/src/content/Backgrounds/GridMotion/GridMotion.vue @@ -9,16 +9,25 @@ interface GridMotionProps { const props = withDefaults(defineProps(), { items: () => [], - gradientColor: 'black' + gradientColor: '#222222' }); const gridRef = ref(null); const rowRefs = ref([]); const mouseX = ref(window.innerWidth / 2); -const totalItems = 28; -const defaultItems = Array.from({ length: totalItems }, (_, i) => `Item ${i + 1}`); -const combinedItems = computed(() => (props.items.length > 0 ? props.items.slice(0, totalItems) : defaultItems)); +const totalItems = 70; +const combinedItems = computed(() => { + if (props.items.length === 0) { + return []; + } + + const repeatedItems = []; + for (let i = 0; i < totalItems; i++) { + repeatedItems.push(props.items[i % props.items.length]); + } + return repeatedItems; +}); function isImage(item: string) { return typeof item === 'string' && item.startsWith('http'); @@ -68,22 +77,26 @@ onMounted(() => {
-
+
-
+
diff --git a/src/demo/Backgrounds/GridMotionDemo.vue b/src/demo/Backgrounds/GridMotionDemo.vue index 4ba14d7..513cc4b 100644 --- a/src/demo/Backgrounds/GridMotionDemo.vue +++ b/src/demo/Backgrounds/GridMotionDemo.vue @@ -1,18 +1,10 @@