TextureProgress
Inherits: Range < Control < CanvasItem < Node < Object
Texture-based progress bar. Useful for loading screens and life or stamina bars.
基于纹理的进度条。 对于加载屏幕和生命或耐力条很有用。
Description
TextureProgress works like ProgressBar, but uses up to 3 textures instead of Godot's Theme resource. It can be used to create horizontal, vertical and radial progress bars.
TextureProgress的工作方式类似于ProgressBar,但最多使用3个纹理而不是Godot的主题资源。 它可用于创建水平,垂直和径向进度条。
Properties
int | fill_mode | 0 |
MouseFilter | mouse_filter | 1 (parent override) |
bool | nine_patch_stretch | false |
Vector2 | radial_center_offset | Vector2( 0, 0 ) |
float | radial_fill_degrees | 360.0 |
float | radial_initial_angle | 0.0 |
int | stretch_margin_bottom | 0 |
int | stretch_margin_left | 0 |
int | stretch_margin_right | 0 |
int | stretch_margin_top | 0 |
Texture | texture_over | |
Texture | texture_progress | |
Texture | texture_under | |
Color | tint_over | Color( 1, 1, 1, 1 ) |
Color | tint_progress | Color( 1, 1, 1, 1 ) |
Color | tint_under | Color( 1, 1, 1, 1 ) |
Methods
int | get_stretch_margin ( Margin margin ) const |
void | set_stretch_margin ( Margin margin, int value ) |
Enumerations
enum FillMode:
- FILL_LEFT_TO_RIGHT = 0 --- The texture_progress fills from left to right.
- text_progress从左到右填充。
- FILL_RIGHT_TO_LEFT = 1 --- The texture_progress fills from right to left.
- texture_progress从右到左填充。
- FILL_TOP_TO_BOTTOM = 2 --- The texture_progress fills from top to bottom.
- texture_progress从上到下填充。
- FILL_BOTTOM_TO_TOP = 3 --- The texture_progress fills from bottom to top.
- texture_progress从下到上填充。
- FILL_CLOCKWISE = 4 --- Turns the node into a radial bar. The texture_progress fills clockwise. See radial_center_offset, radial_initial_angle and radial_fill_degrees to control the way the bar fills up.
- 将节点转换为径向条。texture_progress顺时针填充。请参见radial_center_offset、radial_initial_angle和radial_fill_degrees来控制填充条的方式。
- FILL_COUNTER_CLOCKWISE = 5 --- Turns the node into a radial bar. The texture_progress fills counterclockwise. See radial_center_offset, radial_initial_angle and radial_fill_degrees to control the way the bar fills up.
- 将节点转换为径向条。texture_progress是逆时针填充的。请参见radial_center_offset、radial_initial_angle和radial_fill_degrees来控制填充条的方式。
- FILL_BILINEAR_LEFT_AND_RIGHT = 6 --- The texture_progress fills from the center, expanding both towards the left and the right.
- texture_progress从中心填充,向左和向右扩展。
- FILL_BILINEAR_TOP_AND_BOTTOM = 7 --- The texture_progress fills from the center, expanding both towards the top and the bottom.
- texture_progress从中心填充,同时向顶部和底部扩展。
- FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE = 8 --- Turns the node into a radial bar. The texture_progress fills radially from the center, expanding both clockwise and counterclockwise. See radial_center_offset, radial_initial_angle and radial_fill_degrees to control the way the bar fills up.
- 将节点转换为径向条。texture_progress从中心开始呈放射状填充,同时顺时针和逆时针展开。请参见radial_center_offset、radial_initial_angle和radial_fill_degrees来控制填充条的方式。
Property Descriptions
- int fill_mode
Default | 0 |
Setter | set_fill_mode(value) |
Getter | get_fill_mode() |
The fill direction. See FillMode for possible values.
填充方向。有关可能的值,请参阅FillMode。
- bool nine_patch_stretch
Default | false |
Setter | set_nine_patch_stretch(value) |
Getter | get_nine_patch_stretch() |
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 enable stretching.
如果为真,Godot会像在NinePatchRect中那样处理条的纹理。使用stretch_margin_*属性(如stretch_margin_bottom)来设置9宫格的3×3网格。当使用径向fill_mode时,该设置将启用拉伸。
- Vector2 radial_center_offset
Default | Vector2( 0, 0 ) |
Setter | set_radial_center_offset(value) |
Getter | get_radial_center_offset() |
Offsets texture_progress if fill_mode is FILL_CLOCKWISE or FILL_COUNTER_CLOCKWISE.
如果fill_mode为fill_顺时针或fill_counter_顺时针,则偏移texture_progress。
- float radial_fill_degrees
Default | 360.0 |
Setter | set_fill_degrees(value) |
Getter | get_fill_degrees() |
Upper limit for the fill of texture_progress if fill_mode is FILL_CLOCKWISE or FILL_COUNTER_CLOCKWISE. When the node's value
is equal to its max_value
, the texture fills up to this angle.
如果fill_mode为fill_顺时针或fill_counter_顺时针,texture_progress的填充上限。当节点的值等于它的max_value时,纹理填充到这个角度。
See Range.value, Range.max_value.
请参阅范围值,范围最大值。
- float radial_initial_angle
Default | 0.0 |
Setter | set_radial_initial_angle(value) |
Getter | get_radial_initial_angle() |
Starting angle for the fill of texture_progress if fill_mode is FILL_CLOCKWISE or FILL_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.
如果fill_mode填充,texture_progress的填充起始角度为FILL_CLOCKWISE或FILL_COUNTER_CLOCKWISE。 当节点的值等于其min_value时,纹理根本不显示。 值增加时,纹理将填充并趋向于radial_fill_degrees。
- int stretch_margin_bottom
Default | 0 |
Setter | set_stretch_margin(value) |
Getter | get_stretch_margin() |
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.
9宫格底部行的高度。 边距为16表示9宫格的底角和侧面的高度为16像素。 您可以分别设置所有4个边距值,以创建边框不一致的面板。
- int stretch_margin_left
Default | 0 |
Setter | set_stretch_margin(value) |
Getter | get_stretch_margin() |
The width of the 9-patch's left column.
9宫格的左列的宽度。
- int stretch_margin_right
Default | 0 |
Setter | set_stretch_margin(value) |
Getter | get_stretch_margin() |
The width of the 9-patch's right column.
9宫格的右列的宽度。
- int stretch_margin_top
Default | 0 |
Setter | set_stretch_margin(value) |
Getter | get_stretch_margin() |
The height of the 9-patch's top row.
9宫格顶行的高度。
- Texture texture_over
Setter | set_over_texture(value) |
Getter | get_over_texture() |
Texture that draws over the progress bar. Use it to add highlights or an upper-frame that hides part of texture_progress.
绘制进度条的纹理。 使用它来添加高光或隐藏texture_progress的一部分的上部框架。
- Texture texture_progress
Setter | set_progress_texture(value) |
Getter | get_progress_texture() |
Texture that clips based on the node's value
and fill_mode. As value
increased, the texture fills up. It shows entirely when value
reaches max_value
. It doesn't show at all if value
is equal to min_value
.
根据节点的值和fill_mode进行裁剪的纹理。 随着值的增加,纹理将填满。 它会在value达到max_value时完整显示。 如果value等于min_value则根本不显示。
The value
property comes from Range. See Range.value, Range.min_value, Range.max_value.
值属性来自范围。 请参阅``范围值'',``范围最小值'',``范围最大值''。
- Texture texture_under
Setter | set_under_texture(value) |
Getter | get_under_texture() |
Texture that draws under the progress bar. The bar's background.
在进度条下方绘制的纹理。 bar的背景。
- Color tint_over
Default | Color( 1, 1, 1, 1 ) |
Setter | set_tint_over(value) |
Getter | get_tint_over() |
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.
将bar的“ texture_over”纹理的颜色相乘。 效果与CanvasItem.modulate相似,除了它只影响此特定纹理而不是整个节点。
- Color tint_progress
Default | Color( 1, 1, 1, 1 ) |
Setter | set_tint_progress(value) |
Getter | get_tint_progress() |
Multiplies the color of the bar's texture_progress
texture.
将bar的texture_progress纹理的颜色相乘。
- Color tint_under
Default | Color( 1, 1, 1, 1 ) |
Setter | set_tint_under(value) |
Getter | get_tint_under() |
Multiplies the color of the bar's texture_under
texture.
将bar的“ texture_under”纹理的颜色相乘。