Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to recreate the effect of the one in this video: Breathing walls

enter image description here

This is my first time manipulating images, and because of that, I don't even have a clue where to start.

But I think the way to do this must be transforming the geometry of the image with sine waves, correct me if I'm wrong.

share|improve this question
Take a look at ImageTransformation; – Kuba Jun 4 '14 at 9:56
The author of those videos wrote about it on his blog, although not with the details required to implement the thing it has a good source that might help someone: here. – C. E. Jun 4 '14 at 10:12
The link should be this: – Taiki Jun 4 '14 at 14:15
up vote 5 down vote accepted

Here's a way of implementing sinusoidal undulations, updated to write out an animated gif, and to use a smaller image, as suggested by Murta.

img = ImageTake[Import[""], {200, 500}, {200, 600}];
 Table[ImageTransformation[img, # + {.004 Sin[4 #[[1]] + p], .005 Sin[5 #[[1]] + p]} &, 
   Padding -> Black], {p, 0, 2 Pi, 0.3}], "DisplayDurations" -> 0.3]

You can make the animation smoother by replacing 0.3 with 0.1 or smaller and the DisplayDurations 0.3 to 0.1.

share|improve this answer
Cool.. With ImageResize the effect get more fluid: img = ImageResize[Import[""], 400] – Murta Jun 4 '14 at 16:28
img = Import[""];
image = img[[3]];

gr = Graphics[{EdgeForm[Directive[Thickness[.1], Black]],
FaceForm[Opacity[0]], Rectangle[{0.1, 0.1}, {.9, .9}]}, ImageSize -> 400];

            ParametricPlot3D[{x , y , 1 + .2 ( Cos[ t y + (1 - t) x] )}, 
             {x, -Pi, Pi}, {y, -Pi, Pi},
             Mesh -> False, PerformanceGoal -> "Quality", Boxed -> False, 
             Axes -> False, ImageSize -> 400, 
             Lighting-> "Neutral", (*thanks: Olexandr R. *)
             PlotStyle -> Texture[image], ViewPoint -> Top], gr}, 
      Alignment -> Center], 
 {t, 0, 1}, AnimationRunning -> False, AnimationRate -> .5]

enter image description here

Note: cannot upload the updated gif animation with Neutral lighting for the time being.

share|improve this answer
Needs Lighting -> "Neutral". Otherwise it's the breathing, oddly pinkish, color changing wall. But a definite +1 for a simple and effective approach to producing the undulations. – Oleksandr R. Jun 7 '14 at 0:24
@OleksandrR. thank you - excellent point. – kglr Jun 7 '14 at 0:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.