Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
Gradient
Eredita: Resource < RefCounted < Object
Una transizione di colore.
Descrizione
Questa risorsa descrive una transizione di colore definendo un insieme di punti colorati e come interpolare tra di essi.
Vedi anche Curve che supporta metodi di allentamento più complessi, ma non supporta i colori.
Proprietà
|
||
|
||
|
||
|
Metodi
void |
|
get_offset(point: int) |
|
get_point_count() const |
|
void |
remove_point(point: int) |
void |
reverse() |
void |
|
void |
set_offset(point: int, offset: float) |
Enumerazioni
enum InterpolationMode: 🔗
InterpolationMode GRADIENT_INTERPOLATE_LINEAR = 0
Interpolazione lineare.
InterpolationMode GRADIENT_INTERPOLATE_CONSTANT = 1
Interpolazione costante, il colore cambia bruscamente in ogni punto e rimane uniforme nel mezzo. Ciò potrebbe causare un aliasing visibile quando utilizzato per una texture di gradiente in alcuni casi.
InterpolationMode GRADIENT_INTERPOLATE_CUBIC = 2
Interpolazione cubica.
enum ColorSpace: 🔗
ColorSpace GRADIENT_COLOR_SPACE_SRGB = 0
Spazio colore sRGB.
ColorSpace GRADIENT_COLOR_SPACE_LINEAR_SRGB = 1
Spazio colore SRGB lineare.
ColorSpace GRADIENT_COLOR_SPACE_OKLAB = 2
Spazio colore Oklab. Questo spazio colore fornisce una transizione fluida e uniforme tra i colori.
Descrizioni delle proprietà
PackedColorArray colors = PackedColorArray(0, 0, 0, 1, 1, 1, 1, 1) 🔗
void set_colors(value: PackedColorArray)
PackedColorArray get_colors()
I colori del gradiente come PackedColorArray.
Nota: Impostando questa proprietà si aggiornano tutti i colori allo stesso tempo. Per aggiornare un colore singolarmente, utilizza set_color().
Note: The returned array is copied and any changes to it will not update the original property value. See PackedColorArray for more details.
ColorSpace interpolation_color_space = 0 🔗
void set_interpolation_color_space(value: ColorSpace)
ColorSpace get_interpolation_color_space()
The color space used to interpolate between points of the gradient. It does not affect the returned colors, which will always use nonlinear sRGB encoding.
Note: This setting has no effect when interpolation_mode is set to GRADIENT_INTERPOLATE_CONSTANT.
InterpolationMode interpolation_mode = 0 🔗
void set_interpolation_mode(value: InterpolationMode)
InterpolationMode get_interpolation_mode()
L'algoritmo utilizzato per interpolare tra i punti del gradiente.
PackedFloat32Array offsets = PackedFloat32Array(0, 1) 🔗
void set_offsets(value: PackedFloat32Array)
PackedFloat32Array get_offsets()
Gli offset del gradiente come PackedFloat32Array.
Nota: Impostando questa proprietà si aggiornano tutti gli offset allo stesso tempo. Per aggiornare un offset singolarmente, utilizza set_offset().
Note: The returned array is copied and any changes to it will not update the original property value. See PackedFloat32Array for more details.
Descrizioni dei metodi
void add_point(offset: float, color: Color) 🔗
Aggiunge il colore specificato al gradiente, con l'offset specificato.
Restituisce il colore del gradiente all'indice point.
float get_offset(point: int) 🔗
Restituisce l'offset del colore di colore di gradiente all'indice point.
Restituisce il numero di colori nel gradiente.
void remove_point(point: int) 🔗
Rimuove il colore all'indice point.
void reverse() 🔗
Inverte/specchia il gradiente.
Nota: Questo metodo specchia tutti i punti attorno al centro del gradiente, il che potrebbe produrre risultati inaspettati quando interpolation_mode è impostato su GRADIENT_INTERPOLATE_CONSTANT.
Restituisce il colore interpolato specificato da offset. offset deve essere compreso tra 0.0 e 1.0 (inclusi). Usando un valore inferiore a 0.0 sarà restituito lo stesso colore di 0.0, mentre usando un valore superiore a 1.0 sarà restituito lo stesso colore di 1.0. Se il valore in ingresso non rientra in questo intervallo, si consiglia di utilizzare @GlobalScope.remap() sul valore di input con i valori di output impostati su 0.0 e 1.0.
void set_color(point: int, color: Color) 🔗
Imposta il colore del colore di gradiente all'indice point.
void set_offset(point: int, offset: float) 🔗
Imposta l'offset per il colore del gradiente all'indice point.