# [GIF] Square Up (Trig surface animation)

Posted 3 years ago
3563 Views
|
2 Replies
|
5 Total Likes
|
 Square UpJust an animation of the graph of $f(x,y)=\frac{6}{5} \sin^3(\theta/2) \sin(6 \theta) \sin x \sin y$ as $\theta$ ranges from $0$ to $2\pi$. Of course, originally this was just the surface with PlotStyle->None and with an appropriately-spaced mesh (which, as @J. M. has been pointing out to me in various threads, is much faster), but there doesn't seem to be a good way to get MeshStyle to color a single mesh line in different colors (something like ColorFunctions), so I had to build my own mesh with lines and color it with VertexColors. Also, I'm experimenting with some different code formatting, so let me know if you have any strong opinions: With[ { n = 20, a = 1.2, k = 6, cols = RGBColor /@ {"#28C7FA", "#FF304F", "#002651"} }, Manipulate[ Graphics3D[ { AbsoluteThickness[1.5], Table[ Line[#[[i]], VertexColors -> (Blend[cols[[;; -2]], (# + a)/(2 a)] & /@ #[[i, ;; , 3]])], {i, Length[#]}] & /@ {#, Transpose[#]} &[Table[{2 π (x - 1)/n, 2 π (y - 1)/n, a*Haversine[θ]^(3/2) Sin[k θ] Sin[2 π (x - 1)/n] Sin[2 π (y - 1)/n]}, {x, 1, n + 1}, {y, 1, n + 1}] ] }, Boxed -> False, PlotRange -> {{-.5, 2 π + .5}, {-.5, 2 π + .5}, {-2.5, 2.5}}, ImageSize -> 540, ViewPoint -> {2, 0, 1}, SphericalRegion -> True, Background -> cols[[-1]]], {θ, 0, 2 π}] ] 
2 Replies
Sort By:
Posted 3 years ago
 Yes, it's a known weakness of Mesh that it doesn't take an associated ColorFunction, which is a pity for makers of fine artwork. ;)A physically realistic variant would be to look at the surfaces corresponding to the so-called "Chladni plates" (see e.g. this Demonstration).