Create and animate a rainbow texture-material

Let me give a couple examples of what I’m looking to do.

With material nodes… I think.

  1. A half sphere (dome) where a spectrum ROYGBIV is procedurally painted onto it. For example, if the dome is a uvSphere, with axis along z (up), the top is Red, and the equator is Violet, with interpolation in between.

  2. The above rainbow is cyclic, so that if I compress it, there can be two, or three, etc, rainbows stacked from the top of the sphere to the bottom.

  3. I would like to animate the rainbow so that it travels down from top to the bottom (cyclically). Ultimately, I want to model a cuttlefish changing colors.

Notes: I used to be able to do this math, but its been 20 years (just classes in college). I’m a noobie to blender/3d. I’m thinking that what I want is to take either an interpolated UV or a normal - lets go with a normal for my point - take the normal and translate it so the initial point is at the origin, and rotate it (around z only) so that its on the XY plain, the positive quadrant. I then want to use the angle of the translated normal to map to a ROYGBIV value. So a given face loop of our UVSphere has the same color.

The reason I gave the explanation is that I’d love it if someone offered not only a solution to the problem, but an explanation of what the nodes are doing, so I can use that knowledge in the future. I can handle vector calculus explanations if you tweak my memory.

Thanks,
jdavenport