nubels
1
Godot Version
4.3.dev3
Question
How can I achieve the same effect as sliding down this color ramp from code?

func darken() -> void:
# make the color darker like in the slider
canvas_modulate.color -= Vector4(0.1, 0.1, 0.1, 0) # something like this
You can use one of this :
canvas_modulate.color.darkened(0.5);
canvas_modulate.color.lightened(0.5);
but to made it from only one value, it can be more difficult.
1 Like
nubels
3
Ah thank you! I need to assign the new color, though.
@tool
class_name CanvasModulateTest
extends CanvasModulate
@export var darken_buton: bool:
get():
return false
set(value):
color = color.darkened(0.5)
system
Closed
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.