# Metaballs

> Up to 20 colored gooey balls moving around the center and merging into smooth organic shapes. Ported from Paper Shaders (Apache-2.0).

<demo-paper-metaballs>



</demo-paper-metaballs>

## Installation

```bash
npx shadcn-vue@latest add "https://nxui.geoql.in/r/paper-metaballs.json"
```

## Usage

```vue
<script setup lang="ts">
  import PaperMetaballs from '~/components/ui/paper-metaballs/PaperMetaballs.vue';
</script>

<template>
  <div class="relative h-100 w-full overflow-hidden rounded-lg">
    <PaperMetaballs
      :color-back="'#000000'"
      :colors="['#6e33cc', '#ff5500', '#ffc105', '#ffc800', '#f585ff']"
      :count="10"
      :size="0.83"
      :speed="1"
    />
  </div>
</template>
```

## Props

<table>
<thead>
  <tr>
    <th>
      Prop
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        color-back
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        '#000000'
      </code>
    </td>
    
    <td>
      Background color behind the balls
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        colors
      </code>
    </td>
    
    <td>
      <code>
        string[]
      </code>
    </td>
    
    <td>
      <code>
        ['#6e33cc', '#ff5500', '#ffc105', '#ffc800', '#f585ff']
      </code>
    </td>
    
    <td>
      Up to 8 base colors cycled across the balls
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        count
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        10
      </code>
    </td>
    
    <td>
      Number of balls (1 to 20)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        size
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0.83
      </code>
    </td>
    
    <td>
      Size of the balls (0 to 1)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        speed
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        1
      </code>
    </td>
    
    <td>
      Animation speed multiplier (0 freezes)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        frame
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0
      </code>
    </td>
    
    <td>
      Initial/seek frame for deterministic rendering
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        fit
      </code>
    </td>
    
    <td>
      <code>
        'none' | 'contain' | 'cover'
      </code>
    </td>
    
    <td>
      <code>
        'contain'
      </code>
    </td>
    
    <td>
      How the graphic fits the canvas
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        scale
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        1
      </code>
    </td>
    
    <td>
      Overall zoom level (0.01 to 4)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        rotation
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0
      </code>
    </td>
    
    <td>
      Overall rotation in degrees (0 to 360)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        origin-x
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0.5
      </code>
    </td>
    
    <td>
      Horizontal origin for world positioning (0 to 1)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        origin-y
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0.5
      </code>
    </td>
    
    <td>
      Vertical origin for world positioning (0 to 1)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        offset-x
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0
      </code>
    </td>
    
    <td>
      Horizontal offset of the graphics center (-1 to 1)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        offset-y
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0
      </code>
    </td>
    
    <td>
      Vertical offset of the graphics center (-1 to 1)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        world-width
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0
      </code>
    </td>
    
    <td>
      Virtual world width before canvas fitting
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        world-height
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0
      </code>
    </td>
    
    <td>
      Virtual world height before canvas fitting
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        class
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Additional CSS classes
    </td>
  </tr>
</tbody>
</table>

## Attribution

Powered by [Paper Shaders](https://github.com/paper-design/shaders)
(© Lost Coast Labs, Inc., Apache-2.0) via the framework-agnostic
`@paper-design/shaders` package driven by a Vue 3 mount. This is an
unofficial community port; it is not maintained by Paper.
