GradientTexture2D
A 2D texture that creates a pattern with colors obtained from a Gradient
.
class GradientTexture2D
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
.
Superclasses
class Texture2D
Texture for 2D and 3D.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
Type members
Instance members
var fill: GradientTexture2D.Fill
The gradient fill type, one of the
Fill
values. The texture is filled by interpolating colors starting fromfillFrom
tofillTo
offsets.var fillFrom: Vector2
The initial offset used to fill the texture specified in UV coordinates.
var fillTo: Vector2
The final offset used to fill the texture specified in UV coordinates.
var gradient: Gradient?
The
Gradient
used to fill the texture.var height: Int32
The number of vertical color samples that will be obtained from the
Gradient
, which also represents the texture’s height.var `repeat`: GradientTexture2D.Repeat
The gradient repeat type, one of the
Repeat
values. The texture is filled starting fromfillFrom
tofillTo
offsets by default, but the gradient fill can be repeated to cover the entire texture.var useHdr: Bool
If
true
, the generated texture will support high dynamic range (rgbaf
format). This allows for glow effects to work ifglowEnabled
istrue
. Iffalse
, the generated texture will use low dynamic range; overbright colors will be clamped (rgba8
format).var width: Int32
The number of horizontal color samples that will be obtained from the
Gradient
, which also represents the texture’s width.