If you’re trying to fade from color 1 to transparent I think there is already Color.Transparent to pick from. Then your gradient texture can have the markers set to your solid color to transparent.
I do not know if doing it in code is more impactful than just uploading .pngs. I imagine it depends on how large the pngs are and how large the gradient is.
Yes. If you want this to work in the editor, you have to make it a @tool script.
@export var color_1: Color = Color.RED:
set(value):
color_1 = value
color_2 = value
color_2.a = 0.0
var color_2: Color
As @Josh_W pointed out, there are other ways of doing this. Perhaps it might help if you told us the problem you’re trying to solve with this solution you’ve come up with.
Nothing complicated really. I’m faking a 3D orb by using billboard sprite3D with radial alpha gradient. I just want to have simple @export control over its color and the sharpness/blurriness of the gradient’s edge.
For the color control right now I have something like:
var start_gradient_marker_color = color(1.0,1.0,1.0,1.0)
var end_gradient_marker_color = color(1.0,1.0,1.0,0.0)
and if I wanna change the color of gradient I have to change both of them so I was wondering if I could just change “start_gradient” and “end_gradient” will automatically matched the change while keeping the alpha zero.
For the Edge control though I haven’t figure it out yet what to do but I’m thinking of tweening the markers’ values to make it sharper/blurrier.
*I know I’m doing it the hard way setting up by code but I’m using this project as a learning experience..as long as it doesn’t impact performance too much.