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...
TextureProgressBar
繼承: Range < Control < CanvasItem < Node < Object
基於紋理的進度條。適用於載入螢幕和生命或體力條。
說明
TextureProgressBar 的工作方式類似於 ProgressBar,但最多使用 3 個紋理,不使用 Godot 的 Theme 資源。可用於建立水平、垂直和徑向進度條。
屬性
|
||
mouse_filter |
|
|
|
||
|
||
|
||
|
||
BitField[SizeFlags] |
size_flags_vertical |
|
step |
|
|
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
方法
get_stretch_margin(margin: Side) const |
|
void |
set_stretch_margin(margin: Side, value: int) |
列舉
enum FillMode: 🔗
FillMode FILL_LEFT_TO_RIGHT = 0
texture_progress 從左到右填充。
FillMode FILL_RIGHT_TO_LEFT = 1
texture_progress 從右到左填充。
FillMode FILL_TOP_TO_BOTTOM = 2
texture_progress 從上到下填充。
FillMode FILL_BOTTOM_TO_TOP = 3
texture_progress 自下而上填充。
FillMode FILL_CLOCKWISE = 4
將節點變成徑向條形。texture_progress 順時針填充。參閱radial_center_offset、radial_initial_angle和radial_fill_degrees來控制條形填充的方式。
FillMode FILL_COUNTER_CLOCKWISE = 5
將節點變成徑向條形。texture_progress逆時針填充。參閱radial_center_offset、radial_initial_angle和radial_fill_degrees來控制條形填充的方式。
FillMode FILL_BILINEAR_LEFT_AND_RIGHT = 6
texture_progress從中心開始填充,向左和向右擴充。
FillMode FILL_BILINEAR_TOP_AND_BOTTOM = 7
texture_progress從中心開始填充,同時向頂部和底部擴充。
FillMode FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE = 8
將節點變成徑向條形。texture_progress從中心徑向填充,順時針和逆時針擴展。參閱radial_center_offset、radial_initial_angle和radial_fill_degrees來控制條形填充的方式。
屬性說明
填充方向。可能的取值見 FillMode。
bool nine_patch_stretch = false 🔗
If true, Godot treats the bar's textures like in NinePatchRect. Use the stretch_margin_* properties like stretch_margin_bottom to set up the nine patch's 3×3 grid. When using a radial fill_mode, this setting will only enable stretching for texture_progress, while texture_under and texture_over will be treated like in NinePatchRect.
Vector2 radial_center_offset = Vector2(0, 0) 🔗
Offsets texture_progress if fill_mode is FILL_CLOCKWISE, FILL_COUNTER_CLOCKWISE, or FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE.
Note: The effective radial center always stays within the texture_progress bounds. If you need to move it outside the texture's bounds, modify the texture_progress to contain additional empty space where needed.
float radial_fill_degrees = 360.0 🔗
Upper limit for the fill of texture_progress if fill_mode is FILL_CLOCKWISE, FILL_COUNTER_CLOCKWISE, or FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE. When the node's value is equal to its max_value, the texture fills up to this angle.
See Range.value, Range.max_value.
float radial_initial_angle = 0.0 🔗
Starting angle for the fill of texture_progress if fill_mode is FILL_CLOCKWISE, FILL_COUNTER_CLOCKWISE, or FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE. When the node's value is equal to its min_value, the texture doesn't show up at all. When the value increases, the texture fills and tends towards radial_fill_degrees.
Note: radial_initial_angle is wrapped between 0 and 360 degrees (inclusive).
int stretch_margin_bottom = 0 🔗
The height of the 9-patch's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders. Only effective if nine_patch_stretch is true.
The width of the 9-patch's left column. Only effective if nine_patch_stretch is true.
int stretch_margin_right = 0 🔗
The width of the 9-patch's right column. Only effective if nine_patch_stretch is true.
The height of the 9-patch's top row. Only effective if nine_patch_stretch is true.
在進度條至上繪製的 Texture2D。可用於新增高光,也可用於新增遮擋部分 texture_progress 的上層邊框。
被裁剪的 Texture2D。裁剪基於該節點的 value 和 fill_mode。隨著 value 的增加,該紋理將被填滿。當 value 達到 max_value 時,它將完整顯示。如果 value 等於 min_value,則它根本不顯示。
value 屬性來自 Range。參見 Range.value、Range.min_value、Range.max_value。
Vector2 texture_progress_offset = Vector2(0, 0) 🔗
texture_progress 的偏移量。對於帶有花哨的邊框的 texture_over 和 texture_under 很有用,可以避免進度紋理的邊緣透明。
在進度條下繪製的 Texture2D。該進度條的背景。
Color tint_over = Color(1, 1, 1, 1) 🔗
Multiplies the color of the bar's texture_over texture. The effect is similar to CanvasItem.modulate, except it only affects this specific texture instead of the entire node.
Color tint_progress = Color(1, 1, 1, 1) 🔗
Multiplies the color of the bar's texture_progress texture.
Color tint_under = Color(1, 1, 1, 1) 🔗
Multiplies the color of the bar's texture_under texture.
方法說明
int get_stretch_margin(margin: Side) const 🔗
返回給定索引的拉伸邊距。見 stretch_margin_bottom 及相關屬性。
void set_stretch_margin(margin: Side, value: int) 🔗
設定給定索引的拉伸邊距。見 stretch_margin_bottom 及相關屬性。