From cd0b903a802da13f54861f5a4fb169cce163897d Mon Sep 17 00:00:00 2001 From: Utkarsh-Singhal-26 Date: Mon, 14 Jul 2025 12:31:49 +0530 Subject: [PATCH 1/2] Added animation --- src/constants/Categories.ts | 1 + src/constants/Components.ts | 1 + .../code/Animations/metaBallsCode.ts | 26 ++ .../Animations/MetaBalls/MetaBalls.vue | 267 ++++++++++++++++++ src/demo/Animations/MetaBallsDemo.vue | 204 +++++++++++++ 5 files changed, 499 insertions(+) create mode 100644 src/constants/code/Animations/metaBallsCode.ts create mode 100644 src/content/Animations/MetaBalls/MetaBalls.vue create mode 100644 src/demo/Animations/MetaBallsDemo.vue diff --git a/src/constants/Categories.ts b/src/constants/Categories.ts index db902d6..2216cbf 100644 --- a/src/constants/Categories.ts +++ b/src/constants/Categories.ts @@ -45,6 +45,7 @@ export const CATEGORIES = [ 'Magnet', 'Cubes', 'Blob Cursor', + 'Meta Balls', ] }, { diff --git a/src/constants/Components.ts b/src/constants/Components.ts index 286ed82..641a4b4 100644 --- a/src/constants/Components.ts +++ b/src/constants/Components.ts @@ -13,6 +13,7 @@ const animations = { 'splash-cursor': () => import('../demo/Animations/SplashCursorDemo.vue'), 'noise': () => import('../demo/Animations/NoiseDemo.vue'), 'blob-cursor': () => import('../demo/Animations/BlobCursorDemo.vue'), + 'meta-balls': () => import('../demo/Animations/MetaBallsDemo.vue'), }; const textAnimations = { diff --git a/src/constants/code/Animations/metaBallsCode.ts b/src/constants/code/Animations/metaBallsCode.ts new file mode 100644 index 0000000..54d85f1 --- /dev/null +++ b/src/constants/code/Animations/metaBallsCode.ts @@ -0,0 +1,26 @@ +import code from '@/content/Animations/MetaBalls/MetaBalls.vue?raw'; +import type { CodeObject } from '../../../types/code'; + +export const metaBalls: CodeObject = { + cli: `npx jsrepo add https://vue-bits.dev/ui/Animations/MetaBalls`, + installation: `npm i ogl`, + usage: ` + +`, + code +}; diff --git a/src/content/Animations/MetaBalls/MetaBalls.vue b/src/content/Animations/MetaBalls/MetaBalls.vue new file mode 100644 index 0000000..703d9ac --- /dev/null +++ b/src/content/Animations/MetaBalls/MetaBalls.vue @@ -0,0 +1,267 @@ + + + diff --git a/src/demo/Animations/MetaBallsDemo.vue b/src/demo/Animations/MetaBallsDemo.vue new file mode 100644 index 0000000..eb1496f --- /dev/null +++ b/src/demo/Animations/MetaBallsDemo.vue @@ -0,0 +1,204 @@ + + + From 9567aa86b7458382eb13c76053424e3fdc6a098c Mon Sep 17 00:00:00 2001 From: David Haz Date: Mon, 14 Jul 2025 10:18:39 +0300 Subject: [PATCH 2/2] Add mixBlendMode prop to MetaBalls component and demo --- src/content/Animations/MetaBalls/MetaBalls.vue | 6 ++++-- src/demo/Animations/MetaBallsDemo.vue | 13 +++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/content/Animations/MetaBalls/MetaBalls.vue b/src/content/Animations/MetaBalls/MetaBalls.vue index 703d9ac..224f453 100644 --- a/src/content/Animations/MetaBalls/MetaBalls.vue +++ b/src/content/Animations/MetaBalls/MetaBalls.vue @@ -13,6 +13,7 @@ interface MetaBallsProps { cursorBallSize?: number; cursorBallColor?: string; enableTransparency?: boolean; + mixBlendMode?: string; } type BallParams = { @@ -33,7 +34,8 @@ const props = withDefaults(defineProps(), { clumpFactor: 1, cursorBallSize: 3, cursorBallColor: '#27FF64', - enableTransparency: false + enableTransparency: false, + mixBlendMode: 'normal' }); function parseHexColor(hex: string): [number, number, number] { @@ -263,5 +265,5 @@ watch( diff --git a/src/demo/Animations/MetaBallsDemo.vue b/src/demo/Animations/MetaBallsDemo.vue index eb1496f..a4f1480 100644 --- a/src/demo/Animations/MetaBallsDemo.vue +++ b/src/demo/Animations/MetaBallsDemo.vue @@ -12,6 +12,7 @@ :hoverSmoothness="hoverSmoothness" :clumpFactor="clumpFactor" :speed="speed" + mix-blend-mode="screen" /> @@ -199,6 +200,18 @@ const propData = [ type: 'string', default: '#27FF64', description: 'Color of the cursor ball.' + }, + { + name: 'mixBlendMode', + type: 'string', + default: 'normal', + description: 'CSS mix-blend-mode value for how the metaballs blend with content behind them.' } ]; + +