How to apply gradient colour along a curve? In image 1, I have made an electric spark by applying a displace modifier and cloud texture to a long mesh strip, controlled by a driver following the https://youtu.be/p4UWvg6ixho tutorial. I want to apply a color gradient along the mesh's length so that either tips of the spark are blue and the remaining is white. Below are two attempts I did following tutorials. But couldn't figure out the mapping part myself. Any help please.
Depending on the way your mesh was made, it may or may not have an automatically generated UV map. As @ Master Heavy has commented, if it does, you can use a shader tree like this:



using either X or Y, depending on which dimension of your subdivided plane is the long one.

If the plane does not yet have suitable UVs, then you will have to unwrap it. That may be a supplement to your question .. perhaps the best way to get a clean answer to that would be to share your file on Blend Exchange.