2017-09-13 04:42:36 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-03-01 08:44:37 +08:00
<class name= "Curve" inherits= "Resource" version= "4.1" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-13 04:42:36 +08:00
<brief_description >
2017-12-12 03:05:26 +08:00
A mathematic curve.
2017-09-13 04:42:36 +08:00
</brief_description>
<description >
2019-06-22 07:04:47 +08:00
A curve that can be saved and re-used for other objects. By default, it ranges between [code]0[/code] and [code]1[/code] on the Y axis and positions points relative to the [code]0.5[/code] Y position.
2022-08-05 15:54:46 +08:00
See also [Gradient] which is designed for color interpolation. See also [Curve2D] and [Curve3D].
2017-09-13 04:42:36 +08:00
</description>
<tutorials >
</tutorials>
<methods >
<method name= "add_point" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "position" type= "Vector2" />
<param index= "1" name= "left_tangent" type= "float" default= "0" />
<param index= "2" name= "right_tangent" type= "float" default= "0" />
<param index= "3" name= "left_mode" type= "int" enum= "Curve.TangentMode" default= "0" />
<param index= "4" name= "right_mode" type= "int" enum= "Curve.TangentMode" default= "0" />
2017-09-13 04:42:36 +08:00
<description >
2019-06-27 18:34:26 +08:00
Adds a point to the curve. For each side, if the [code]*_mode[/code] is [constant TANGENT_LINEAR], the [code]*_tangent[/code] angle (in degrees) uses the slope of the curve halfway to the adjacent point. Allows custom assignments to the [code]*_tangent[/code] angle if [code]*_mode[/code] is set to [constant TANGENT_FREE].
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "bake" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2017-09-13 04:42:36 +08:00
<description >
2017-12-12 03:05:26 +08:00
Recomputes the baked cache of points for the curve.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "clean_dupes" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2017-09-13 04:42:36 +08:00
<description >
2022-11-01 22:29:38 +08:00
Removes duplicate points, i.e. points that are less than 0.00001 units (engine epsilon value) away from their neighbor on the curve.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "clear_points" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2017-09-13 04:42:36 +08:00
<description >
2017-12-12 03:05:26 +08:00
Removes all points from the curve.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "get_point_left_mode" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" enum= "Curve.TangentMode" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "index" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-13 01:13:27 +08:00
Returns the left [enum TangentMode] for the point at [param index].
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "get_point_left_tangent" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "float" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "index" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-13 01:13:27 +08:00
Returns the left tangent angle (in degrees) for the point at [param index].
2017-09-13 04:42:36 +08:00
</description>
</method>
2017-09-10 21:37:49 +08:00
<method name= "get_point_position" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "Vector2" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "index" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-13 01:13:27 +08:00
Returns the curve coordinates for the point at [param index].
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "get_point_right_mode" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" enum= "Curve.TangentMode" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "index" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-13 01:13:27 +08:00
Returns the right [enum TangentMode] for the point at [param index].
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "get_point_right_tangent" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "float" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "index" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-13 01:13:27 +08:00
Returns the right tangent angle (in degrees) for the point at [param index].
2017-09-13 04:42:36 +08:00
</description>
</method>
2022-07-25 00:47:57 +08:00
<method name= "remove_point" >
<return type= "void" />
<param index= "0" name= "index" type= "int" />
<description >
2023-04-27 03:36:04 +08:00
Removes the point at [param index] from the curve.
2022-07-25 00:47:57 +08:00
</description>
</method>
<method name= "sample" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "float" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "offset" type= "float" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-13 01:13:27 +08:00
Returns the Y value for the point that would exist at the X position [param offset] along the curve.
2017-09-13 04:42:36 +08:00
</description>
</method>
2022-07-25 00:47:57 +08:00
<method name= "sample_baked" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "float" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "offset" type= "float" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-13 01:13:27 +08:00
Returns the Y value for the point that would exist at the X position [param offset] along the curve using the baked cache. Bakes the curve's points if not already baked.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "set_point_left_mode" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "index" type= "int" />
<param index= "1" name= "mode" type= "int" enum= "Curve.TangentMode" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-13 01:13:27 +08:00
Sets the left [enum TangentMode] for the point at [param index] to [param mode].
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "set_point_left_tangent" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "index" type= "int" />
<param index= "1" name= "tangent" type= "float" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-13 01:13:27 +08:00
Sets the left tangent angle for the point at [param index] to [param tangent].
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "set_point_offset" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "index" type= "int" />
<param index= "1" name= "offset" type= "float" />
2017-09-13 04:42:36 +08:00
<description >
2019-06-22 07:04:47 +08:00
Sets the offset from [code]0.5[/code].
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "set_point_right_mode" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "index" type= "int" />
<param index= "1" name= "mode" type= "int" enum= "Curve.TangentMode" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-13 01:13:27 +08:00
Sets the right [enum TangentMode] for the point at [param index] to [param mode].
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "set_point_right_tangent" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "index" type= "int" />
<param index= "1" name= "tangent" type= "float" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-13 01:13:27 +08:00
Sets the right tangent angle for the point at [param index] to [param tangent].
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "set_point_value" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "index" type= "int" />
<param index= "1" name= "y" type= "float" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-13 01:13:27 +08:00
Assigns the vertical position [param y] to the point at [param index].
2017-09-13 04:42:36 +08:00
</description>
</method>
</methods>
<members >
2019-06-29 18:38:01 +08:00
<member name= "bake_resolution" type= "int" setter= "set_bake_resolution" getter= "get_bake_resolution" default= "100" >
2017-12-12 03:05:26 +08:00
The number of points to include in the baked (i.e. cached) curve data.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "max_value" type= "float" setter= "set_max_value" getter= "get_max_value" default= "1.0" >
2019-06-29 21:24:23 +08:00
The maximum value the curve can reach.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "min_value" type= "float" setter= "set_min_value" getter= "get_min_value" default= "0.0" >
2019-06-29 21:24:23 +08:00
The minimum value the curve can reach.
2017-09-13 04:42:36 +08:00
</member>
2022-02-13 02:12:22 +08:00
<member name= "point_count" type= "int" setter= "set_point_count" getter= "get_point_count" default= "0" >
The number of points describing the curve.
</member>
2017-09-13 04:42:36 +08:00
</members>
<signals >
<signal name= "range_changed" >
<description >
2017-12-12 03:05:26 +08:00
Emitted when [member max_value] or [member min_value] is changed.
2017-09-13 04:42:36 +08:00
</description>
</signal>
</signals>
<constants >
2017-11-25 06:16:30 +08:00
<constant name= "TANGENT_FREE" value= "0" enum= "TangentMode" >
2017-12-12 03:05:26 +08:00
The tangent on this side of the point is user-defined.
2017-09-16 07:46:14 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "TANGENT_LINEAR" value= "1" enum= "TangentMode" >
2017-12-12 03:05:26 +08:00
The curve calculates the tangent on this side of the point as the slope halfway towards the adjacent point.
2017-09-16 07:46:14 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "TANGENT_MODE_COUNT" value= "2" enum= "TangentMode" >
2017-12-12 03:05:26 +08:00
The total number of available tangent modes.
2017-09-16 07:46:14 +08:00
</constant>
2017-09-13 04:42:36 +08:00
</constants>
</class>