A Better Ripple Effect. Now with source code!
I wanted to make a ripple effect that distorted the image more realistically. The trick is coming up with the right displacement map. In the displacement map, one color channel controls x-axis displacement and another controls y-axis displacement. Here is an example of what I came up with. This is generated algorithmically.

Download the source code.
how can I get the source code for this?
By asking! Download it using the link above.
How would I modify the code so the effect is an ellipse, not a circle?
Hey, how easy would it to be to use a custom shape to create the ripple filter?
Hi there, amazing work with this! I have a question though… I would like to use this effect, to create a ripple, upon clicking a button, as if the button was slightly under water.
However, I receive the following error when trying this: “Call to a possibly undefined method Point.
Any advice as to how to do this would be fantastic!
Mr. Brill, I’d been banging my head about multiple instances of animated DMFs (instantiated from a custom class I’d been working on) for probably four or five hours last night: I just couldn’t figure out how to prevent adding a new instance from totally ruining any preexisting instances. I took a closer look at your code, and I’ve just gotta say: the idea of using the DMF’s color property as an identifier was brilliant! Borrowing oh-so-modestly from your code, I updated my own and it works as advertised! Consider your praises sung!!!
(And thanks!)
Hi – this is a great effect. I’ve read your code and seen that it says it is free for use. Just thought I’d double check that it is OK to use it in a commercial project I’m doing. Thanks, Pete
Was looking for this exact effect; very nicely implemented. thanks so much for sharing!
hey there!
Thanks for the source. The effect is great.
Question:
How could i modify the code to make it work with mouse roll_over action?
Thanks!
Hi there, amazing work with this! I have a question though… I would like to use this effect, to create a ripple, upon clicking a button, as if the button was slightly under water. However, I receive the following error when trying this: “Call to a possibly undefined method Point. Any advice as to how to do this would be fantastic!