# Smoother jelly / water effect on an image

I'm trying to achieve a jelly / water surface effect. I'd like it to be a bit smoother. Here I am taking a triangulated rectangle and perturbing all points by a little random noise for each frame. This warps the polygons and stretches the texture so it looks like it's a turbulent liquid surface:

img = ExampleData[{"TestImage", "House"}];
mesh = TriangulateMesh@Rectangle[{0, 0}, {1, 1}];
coords = MeshCoordinates[mesh];
cells = MeshCells[mesh, 2];
texture = Texture[img];

Table[With[{newcoords = coords + 0.01*RandomPoint[Disk[], Length[coords]]},
Rasterize[
Graphics[{texture,
GraphicsComplex[newcoords, cells,
VertexTextureCoordinates -> coords]}]]
], {30}] // ListAnimate To make this better and less jumpy I think I need to accumulate the small random disturbances of the coordinates of the mesh. But I don't want any point on the mesh to drift and deform its polygon so much over time that it becomes highly distorted with extreme self-intersections. Any ideas how I can do this and not push up computation time?

perhaps:

timg = ImageEffect[img, {"TornFrame"}];

tr[t_] := # + {5 10^-3 Cos[20 #[] + 5 t], 5 10^-3 Sin[20 #[] + 5 t]} &

frames = Table[ImageTransformation[timg, tr[t]], {t, Subdivide[0, 2 Pi, 40]}];

ListAnimate @ frames • Nice. No need for triangulation as it turns out, and it's smooth. Nov 14, 2020 at 17:49

This method seems to work quite well. Instead of changing the positions randomly, I rotate each vertex around in a small circle centered at each original vertex position. Every vertex starts at a randomly assigned phase so the polygons are not all in sync:

img = ExampleData[{"TestImage", "House"}];
mesh = TriangulateMesh[Rectangle[{0, 0}, {1, 1}],
MaxCellMeasure -> .003]
coords = MeshCoordinates[mesh];
cells = MeshCells[mesh, 2];
texture = Texture[img];
phases = RandomReal[{0, 2 Pi}, Length[coords]];
amplitude = 0.012;
frequency = 1.;
period = 1/30.;
ParallelTable[
With[{newcoords = 