Drawing 2D Lines - Easiest way to achieve this effect?

I’m making a 2D game and I want to simply draw a line between 2 points. I also want to be able to make the colour change along the line depending on a float between 0 and 1, representing progression along that line. I’ve accomplished this effect before outside of Unreal using C++ and OpenGL shaders by drawing a line primitive with 2 vertices, and I’ve included an image of that.

I see 3 functions in Blueprints called Draw Line. One for a Canvas, a HUD and a Paint Context Structure. Would one of these functions be best suited to doing this, or would it be better if I created some sort of custom solution? I’m not sure where I’d begin with doing it myself, but either way I’d need to be able to easily control the resolution/scale it so it’d always fit in with the other graphics.

There must be a quick and easy way to do this, surely?

Emmiter: Beam emmiter

If you want to use the draw line function you could have 2 lines on top of each other. The second one, or top one, will be your progression line and be rendered on top. 0 can be no top line, 1 can be the full top line. Should do what you want. I’ve used this method for health bars with boxes, not lines and it works fine.

Ah… interesting. I’d wondered about particle systems but I couldn’t quite see how it would work at the time. A beam emitter sounds promising. I’ll look into that.

Yeah, something like that would probably be an idea depending on how beam emitters work. The fragment shader made it quite easy to do the progression thing when I did it in OpenGL but here might be more complicated…