GradientTexture2D
继承: Texture2D
< Texture
< Resource
< RefCounted
< Object
A 2D texture that creates a pattern with colors obtained from a Gradient
.
描述
A 2D texture that obtains colors from a Gradient
to fill the texture data. This texture is able to transform a color transition into different patterns such as a linear or a radial gradient. The gradient is sampled individually for each pixel so it does not necessarily represent an exact copy of the gradient(see width
and height
). See also GradientTexture1D
, CurveTexture
and CurveXYZTexture
.
属性
Fill | fill |
Vector2 | fill_from |
Vector2 | fill_to |
Gradient | gradient |
int | height |
Repeat | repeat |
bool | resource_local_to_scene |
bool | use_hdr |
int | width |
枚举
enum Fill:
Fill FILL_LINEAR = 0
The colors are linearly interpolated in a straight line.
Fill FILL_RADIAL = 1
The colors are linearly interpolated in a circular pattern.
Fill FILL_SQUARE = 2
The colors are linearly interpolated in a square pattern.
enum Repeat:
Repeat REPEAT_NONE = 0
The gradient fill is restricted to the range defined by fill_from
to fill_to
offsets.
Repeat REPEAT = 1
The texture is filled starting from fill_from
to fill_to
offsets, repeating the same pattern in both directions.
Repeat REPEAT_MIRROR = 2
The texture is filled starting from fill_from
to fill_to
offsets, mirroring the pattern in both directions.
属性说明
Fill fill = 0
The gradient fill type, one of the Fill values. The texture is filled by interpolating colors starting from fill_from
to fill_to
offsets.
Vector2
fill_from = Vector2(0, 0)
The initial offset used to fill the texture specified in UV coordinates.
Vector2
fill_to = Vector2(1, 0)
The final offset used to fill the texture specified in UV coordinates.
Gradient
gradient
The Gradient
used to fill the texture.
int
height = 64
The number of vertical color samples that will be obtained from the Gradient
, which also represents the texture's height.
Repeat repeat = 0
The gradient repeat type, one of the Repeat values. The texture is filled starting from fill_from
to fill_to
offsets by default, but the gradient fill can be repeated to cover the entire texture.
bool
use_hdr = false
If true
, the generated texture will support high dynamic range (Image.FORMAT_RGBAF
format). This allows for glow effects to work if Environment.glow_enabled
is true
. If false
, the generated texture will use low dynamic range; overbright colors will be clamped (Image.FORMAT_RGBA8
format).
int
width = 64
The number of horizontal color samples that will be obtained from the Gradient
, which also represents the texture's width.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。