Inherits: Node2D < CanvasItem < Node < Object
A 2D line.
A line through several points in 2D space.
Note: By default, Godot can only draw up to 4,096 polygon points at a time. To increase this limit, open the Project Settings and increase ProjectSettings.rendering/limits/buffers/canvas_polygon_buffer_size_kb and ProjectSettings.rendering/limits/buffers/canvas_polygon_index_buffer_size_kb.
| bool | antialiased | false |
| LineCapMode | begin_cap_mode | 0 |
| Color | default_color | Color( 0.4, 0.5, 1, 1 ) |
| LineCapMode | end_cap_mode | 0 |
| Gradient | gradient | |
| LineJointMode | joint_mode | 0 |
| PoolVector2Array | points | PoolVector2Array( ) |
| int | round_precision | 8 |
| float | sharp_limit | 2.0 |
| Texture | texture | |
| LineTextureMode | texture_mode | 0 |
| float | width | 10.0 |
| Curve | width_curve |
| void | add_point ( Vector2 position, int at_position=-1 ) |
| void | clear_points ( ) |
| int | get_point_count ( ) const |
| Vector2 | get_point_position ( int i ) const |
| void | remove_point ( int i ) |
| void | set_point_position ( int i, Vector2 position ) |
enum LineJointMode:
sharp_limit is greater than the rotation of a joint, it becomes a bevel joint instead.enum LineCapMode:
enum LineTextureMode:
| Default | false |
| Setter | set_antialiased(value) |
| Getter | get_antialiased() |
If true, the line's border will be anti-aliased.
| Default | 0 |
| Setter | set_begin_cap_mode(value) |
| Getter | get_begin_cap_mode() |
Controls the style of the line's first point. Use LineCapMode constants.
| Default | Color( 0.4, 0.5, 1, 1 ) |
| Setter | set_default_color(value) |
| Getter | get_default_color() |
The line's color. Will not be used if a gradient is set.
| Default | 0 |
| Setter | set_end_cap_mode(value) |
| Getter | get_end_cap_mode() |
Controls the style of the line's last point. Use LineCapMode constants.
| Setter | set_gradient(value) |
| Getter | get_gradient() |
The gradient is drawn through the whole line from start to finish. The default color will not be used if a gradient is set.
| Default | 0 |
| Setter | set_joint_mode(value) |
| Getter | get_joint_mode() |
The style for the points between the start and the end.
| Default | PoolVector2Array( ) |
| Setter | set_points(value) |
| Getter | get_points() |
The points that form the lines. The line is drawn between every point set in this array. Points are interpreted as local vectors.
| Default | 8 |
| Setter | set_round_precision(value) |
| Getter | get_round_precision() |
The smoothness of the rounded joints and caps. This is only used if a cap or joint is set as round.
| Default | 2.0 |
| Setter | set_sharp_limit(value) |
| Getter | get_sharp_limit() |
The direction difference in radians between vector points. This value is only used if joint mode is set to LINE_JOINT_SHARP.
| Setter | set_texture(value) |
| Getter | get_texture() |
The texture used for the line's texture. Uses texture_mode for drawing style.
| Default | 0 |
| Setter | set_texture_mode(value) |
| Getter | get_texture_mode() |
The style to render the texture on the line. Use LineTextureMode constants.
| Default | 10.0 |
| Setter | set_width(value) |
| Getter | get_width() |
The line's width.
| Setter | set_curve(value) |
| Getter | get_curve() |
The line's width varies with the curve. The original width is simply multiply by the value of the Curve.
Adds a point at the position. Appends the point at the end of the line.
If at_position is given, the point is inserted before the point number at_position, moving that point (and every point after) after the inserted point. If at_position is not given, or is an illegal value (at_position < 0 or at_position >= [method get_point_count]), the point will be appended at the end of the point list.
Removes all points from the line.
Returns the Line2D's amount of points.
Returns point i's position.
Removes the point at index i from the line.
Overwrites the position in point i with the supplied position.
© 2014–2020 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
https://docs.godotengine.org/en/3.2/classes/class_line2d.html