Gradient¶
继承¶
Resource
简要描述¶
颜色内插器资源,可用于在用户定义的色点之间生成颜色。
描述¶
给定一组颜色,此资源将按顺序对它们进行插值。这意味着,如果您具有颜色1,颜色2和颜色3,则渐变将从颜色1过渡到颜色2,从颜色2过渡到颜色3。渐变最初将具有2种颜色(黑色和白色),一种(黑色)。 在过渡起点下偏移量是0,另一个(白色)在过渡终点上偏移量是1。
成员¶
| 类型 | 属性名 | 默认值 |
|---|---|---|
| PoolColorArray | colors | PoolColorArray( 0, 0, 0, 1, 1, 1, 1, 1 ) |
| PoolRealArray | offsets | PoolRealArray( 0, 1 ) |
方法¶
| 返回值类型 | 方法名称 |
|---|---|
| void | add_point(offset: float, color: Color) |
| Color | get_color(point: int) const |
| float | get_offset(point: int) const |
| int | get_point_count() const |
| Color | interpolate(offset: float) |
| void | remove_point(offset: int) |
| void | set_color(point: int, color: Color) |
| void | set_offset(point: int, offset: float) |
常量¶
成员说明¶
- PoolColorArray colors
| Default | PoolColorArray( 0, 0, 0, 1, 1, 1, 1, 1 ) |
|---|---|
| setter | set_colors(value) |
| getter | get_colors |
- PoolRealArray offsets
| Default | PoolRealArray( 0, 1 ) |
|---|---|
| setter | set_offsets(value) |
| getter | get_offsets |
方法说明¶
- add_point add_point(offset: float, color: Color)
将指定的颜色添加到渐变的末尾,并带有指定的偏移量。
- get_color get_color(point: int) const
返回索引point处的渐变颜色。
- get_offset get_offset(point: int) const
返回索引point处渐变颜色的偏移量。
- get_point_count get_point_count() const
返回渐变中的颜色数量。
- interpolate interpolate(offset: float)
返回由offset指定的插值颜色。
- remove_point remove_point(offset: int)
删除索引offset处的颜色。
- set_color set_color(point: int, color: Color)
在索引point处设置渐变颜色的颜色。
- set_offset set_offset(point: int, offset: float)
在索引point处设置渐变颜色的偏移量。