# Gradient colors ramp Shader Node - Vertical and static (animated object)

I am trying to create an animation similar with this image:

and this is what I created:

using this node:

I'd like the colors to remain in same position while the helix spring is rotating.

This is my result, but I am not satisfied, the colors should be similar with first picture and remain in same position while the helix is rotating:

• Assuming this is a curve object, you can use UV coordinates. May 19 at 14:12

As @Allen Simpson has commented:

If you use a single cyclic Bezier curve, given thickness with its native Bevel, (set in its Data tab > Geometry panel,) it is automatically mapped 0->1 in U along its length.

So a node arrangement like this can set the color-ramp's range of colors along its length:

The Add and Wrap nodes are optional: changing the 'Add' value shifts the whole range along the curve.

• ok, Robin, your model looks a liiiiiiiiiiiiiiiitle bit better than mine...i have to admit that! :D May 20 at 8:43
• @Chris.. it's a fudge. I have to confess I haven't found the way to make the connections between spirals at an exact tangent. Challenge for you :D. May 20 at 9:11
• @Chris I'm learning every day, too. My main reason for being here. External spiral: Curve > Spheric. Internal spiral: Single vert, Screw modifier, so adjustable. Eyeballed, converted to curve, joined, smoothed. Yuk. I want a nice clean mathematical way :D May 20 at 9:26
• so you cleverly rotated your object to hide your ugly connection? ;) :D Damn...you are so clever!!! ok...well...i should not complain about ugly ... ;) May 20 at 10:34
• @Chris Yup! I used to work in the film industry. Stop-motion animation on to 35mm, Important lesson ?... It's all 2D in the end. Only the pixels matter. Whatever it takes. :D May 20 at 11:14

if your spiral is in the origin you can use this node setup:

Play with the threshold to get your desired result.

and you get this: (seen from above)

what the setup does is: it calculates the length (xx + yy) and checks whether it is inside a given range (threshold) and if it is, it takes the first colorramp, else the second.

sideview:

sorry for my bad modelling. Modelling is not my strength :(