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.

ProgressBar

繼承: Range < Control < CanvasItem < Node < Object

將百分比視覺化表示的控制項。

說明

A control used for visual representation of a percentage. Shows the fill percentage in the center. Can also be used to show indeterminate progress. For more fill modes, use TextureProgressBar instead.

屬性

bool

editor_preview_indeterminate

int

fill_mode

0

bool

indeterminate

false

bool

show_percentage

true

主題屬性

Color

font_color

Color(0.95, 0.95, 0.95, 1)

Color

font_outline_color

Color(0, 0, 0, 1)

int

outline_size

0

Font

font

int

font_size

StyleBox

background

StyleBox

fill


列舉

enum FillMode: 🔗

FillMode FILL_BEGIN_TO_END = 0

進度條從開頭到結尾水平填充,開頭和結尾的位置取決於語言的方向。如果 Control.is_layout_rtl() 返回 false 則為從左至右填充,如果返回 true 則為從右至左填充。

FillMode FILL_END_TO_BEGIN = 1

進度條從結尾到開頭水平填充,開頭和結尾的位置取決於語言的方向。如果 Control.is_layout_rtl() 返回 false 則為從左至右填充,如果返回 true 則為從右至左填充。

FillMode FILL_TOP_TO_BOTTOM = 2

進度從上到下填充。

FillMode FILL_BOTTOM_TO_TOP = 3

進度從下到上填充。


屬性說明

bool editor_preview_indeterminate 🔗

  • void set_editor_preview_indeterminate(value: bool)

  • bool is_editor_preview_indeterminate_enabled()

If false, the indeterminate animation will be paused in the editor.


int fill_mode = 0 🔗

  • void set_fill_mode(value: int)

  • int get_fill_mode()

填充方向。可能的取值見 FillMode


bool indeterminate = false 🔗

  • void set_indeterminate(value: bool)

  • bool is_indeterminate()

When set to true, the progress bar indicates that something is happening with an animation, but does not show the fill percentage or value.


bool show_percentage = true 🔗

  • void set_show_percentage(value: bool)

  • bool is_percentage_shown()

true 時,將在進度條上顯示百分比。


主題屬性說明

Color font_color = Color(0.95, 0.95, 0.95, 1) 🔗

文字的顏色。


Color font_outline_color = Color(0, 0, 0, 1) 🔗

ProgressBar 的文字輪廓的色調。


int outline_size = 0 🔗

文字輪廓的大小。

注意:如果使用啟用了 FontFile.multichannel_signed_distance_field 的字形,其 FontFile.msdf_pixel_range 必須至少設定為 outline_size兩倍,輪廓算繪才能看起來正確。否則,輪廓可能會比預期的更早被切斷。


Font font 🔗

show_percentagetrue 時,用於繪製填充百分比的字形。


int font_size 🔗

show_percentagetrue 時,用於繪製填充百分比的字形。


StyleBox background 🔗

背景的樣式。


StyleBox fill 🔗

進度的樣式(即填充進度條的部分)。