Realistic Water Ripple Effect Using WebGL – ripple-effect.js

Category: Animation , Javascript , Recommended | September 7, 2021
Author:SaboSuke
Views Total:2,953 views
Official Page:Go to website
Last Update:September 7, 2021
License:MIT

Preview:

Realistic Water Ripple Effect Using WebGL – ripple-effect.js

Description:

A vanilla JavaScript library that applies realistic water ripple effect to images using WebGL.

Based on Three.js and GSAP JavaScript libraries.

See It In Action:

See Also:

How to use it:

1. Load the needed JavaScript libraries as follows:

<!-- Three.js -->
<script src="/path/to/cdn/three.min.js"></script>
<!-- GSAP -->
<script src="/path/to/cdn/gsap.min.js"></script>
<!-- ripple-effect.js -->
<script src="src/ripple-effect.min.js"></script>

2. Create a container to hold the image.

<div class="example"></div>

3. Apply a basic ripple effect to the image.

var rippleDemo = new RippleEffect({
    parent: document.querySelector('.example'),      
    texture: '/path/to/image.jpg',
});

4. Config the ripple effect with the following parameters:

var rippleDemo = new RippleEffect({
    parent: document.querySelector('.example'),      
    texture: '/path/to/image.jpg',
    intensity: 1,
    strength: 2,
    area: 6,
    waveSpeed: 0.01,
    hover: true, // trigger the animation on hover
    speedIn: 1.4,
    speedOut: 1.2,
    easing: 'Expo.easeOut',
});

5. Start & Stop the animation manually.

rippleDemo.start
rippleDemo.stop

Changelog:

09/07/2021

  • Code refactor

You Might Be Interested In:


One thought on “Realistic Water Ripple Effect Using WebGL – ripple-effect.js

  1. Sanjib

    Hi, can you tell me with hover how can i do the Realistic Water Ripple Effect?
    If you give me a quick replay then it is very help ping me.

    Reply

Leave a Reply