# How to achieve trippy breathing effect (visual drifting) on static photo

How can I achieve a trippy visual drifting effect like the image is breathing?

See The Visual Components of a Psychedelic Experience - Visual drifting section or more precisely this fragment of this video.

Any software solution is fine, but I would be most thrilled with an implementation in Processing or Javascript

• What do you mean by an implementation in "Processing"? If you are trying to do this programatically, it may be a better fit for Stack Overflow. Can you also describe the effect more directly in your question? The youtube link you provide is already dead on copyright grounds and the other link could go dead in the future. While external clarifications are helpful, it is best if your question is still able to stand alone without them. Mar 10, 2014 at 14:56
• Processing is a programming lanuage geared towards video manipulation and visual effects. processing.org Mar 10, 2014 at 18:19
• BTW, you could probably hold a photo in front of the camera and move it around to get any effect you want. It won't look perfect, of course, but it's an option. Mar 10, 2014 at 18:48

You can achieve an effect like this with a couple of distortion filters from most video editing or motion graphics packages. For example in FCPX/Motion, you could apply a couple of Bulge distortion filters to the upper right and lower left and adjust the scale and radius as appropriate.

In terms of implementing it yourself, I agree that it's a question for StackOverflow (once you've attempted to write it yourself). The algorithm is fairly straightforward. For all the pixels within the radius, apply a mapping function along the vector from the center to the current point. For example (in pseudo code):

``````distort (vec2 center, float radius, float amount)
{
for (each pixel in the image)
{
vec2 dir = pixel.coord - center;
float dist = dir.length()
{
outPixel = pixel;
}
else
{
float percent = dist / radius;
float newPos = pow(percent, amount);
dir = dir / dist;
vec2 newCoord = dir * newPos * radius;
outPixel = getPixel(newCoord);
}
}
}
``````