# Ripple Transition

> WebGL image transitions with noisy refractive waves, chromatic edges, glow, and click-triggered ripple origins.

<demo-ripple-transition>



</demo-ripple-transition>

## Installation

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

## Usage

```vue
<script setup lang="ts">
  import RippleTransition from '~/components/ui/ripple-transition/RippleTransition.vue';
</script>

<template>
  <RippleTransition
    :images="['/photos/forest.jpg', '/photos/canyon.jpg', '/photos/river.jpg']"
    :duration="1.4"
    auto-play
    :auto-play-interval="3200"
    auto-play-origin="random"
    class="h-100"
  />
</template>
```

Clicking (or pressing Enter/Space) launches a ripple from that point: a
noise-warped wavefront expands outward, radially displacing the image with
chromatic aberration and a bloom highlight along the band, revealing the
next image behind it. With three or more images the component cycles
through them, rebinding the hidden texture slot after each swap.

## Props

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

<tbody>
  <tr>
    <td>
      <code>
        images
      </code>
    </td>
    
    <td>
      <code>
        string[]
      </code>
    </td>
    
    <td>
      3 sample shots
    </td>
    
    <td>
      Images to transition between (min. two)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        duration
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        1.4
      </code>
    </td>
    
    <td>
      Transition duration in seconds
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        auto-play
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        false
      </code>
    </td>
    
    <td>
      Trigger transitions on an interval
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        auto-play-interval
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        3200
      </code>
    </td>
    
    <td>
      Milliseconds between automatic transitions
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        auto-play-origin
      </code>
    </td>
    
    <td>
      <code>
        'center' | 'random'
      </code>
    </td>
    
    <td>
      <code>
        'center'
      </code>
    </td>
    
    <td>
      Start point for autoplay ripples
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        wave-speed
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        1.6
      </code>
    </td>
    
    <td>
      Speed of the expanding wavefront
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        sigma
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0.15
      </code>
    </td>
    
    <td>
      Thickness of the main ripple band
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        wave-freq
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        5
      </code>
    </td>
    
    <td>
      Frequency of the small concentric ripples
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        push-amt
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0.145
      </code>
    </td>
    
    <td>
      Amount of radial image displacement
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        ca-strength
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0.02
      </code>
    </td>
    
    <td>
      Chromatic aberration strength
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        glow
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0.73
      </code>
    </td>
    
    <td>
      Bloom-like highlight strength on the wave
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        noise-warp
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        1
      </code>
    </td>
    
    <td>
      Noise applied to the ripple edge
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        pinch
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        false
      </code>
    </td>
    
    <td>
      Subtle inward pull at the ripple origin
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        border-radius
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        24
      </code>
    </td>
    
    <td>
      Root border radius in pixels
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        background
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        '#111416'
      </code>
    </td>
    
    <td>
      Canvas fallback background
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        label
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Accessible label for the interactive region
    </td>
  </tr>
</tbody>
</table>

## Credits

Ported from [componentry.fun](https://componentry.dev/docs/components/ripple-transition)
by [@harshjdhv](https://x.com/harshjdhv).
