.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the Curve.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_Curve: Curve ===== **Inherits:** :ref:`Resource` **<** :ref:`Reference` **<** :ref:`Object` **Category:** Core Brief Description ----------------- A mathematic curve. Member Functions ---------------- +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`add_point` **(** :ref:`Vector2` position, :ref:`float` left_tangent=0, :ref:`float` right_tangent=0, :ref:`int` left_mode=0, :ref:`int` right_mode=0 **)** | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`bake` **(** **)** | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clean_dupes` **(** **)** | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_points` **(** **)** | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_point_left_mode` **(** :ref:`int` index **)** const | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_point_left_tangent` **(** :ref:`int` index **)** const | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_point_position` **(** :ref:`int` index **)** const | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_point_right_mode` **(** :ref:`int` index **)** const | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_point_right_tangent` **(** :ref:`int` index **)** const | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`interpolate` **(** :ref:`float` offset **)** const | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`interpolate_baked` **(** :ref:`float` offset **)** | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_point` **(** :ref:`int` index **)** | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_point_left_mode` **(** :ref:`int` index, :ref:`int` mode **)** | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_point_left_tangent` **(** :ref:`int` index, :ref:`float` tangent **)** | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`set_point_offset` **(** :ref:`int` index, :ref:`float` offset **)** | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_point_right_mode` **(** :ref:`int` index, :ref:`int` mode **)** | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_point_right_tangent` **(** :ref:`int` index, :ref:`float` tangent **)** | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_point_value` **(** :ref:`int` index, :ref:`float` y **)** | +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Signals ------- .. _class_Curve_range_changed: - **range_changed** **(** **)** Emitted when :ref:`max_value` or :ref:`min_value` is changed. Member Variables ---------------- .. _class_Curve_bake_resolution: - :ref:`int` **bake_resolution** - The number of points to include in the baked (i.e. cached) curve data. .. _class_Curve_max_value: - :ref:`float` **max_value** - The maximum value the curve can reach. Default value: ``1``. .. _class_Curve_min_value: - :ref:`float` **min_value** - The minimum value the curve can reach. Default value: ``0``. Enums ----- .. _enum_Curve_TangentMode: enum **TangentMode** - **TANGENT_FREE** = **0** --- The tangent on this side of the point is user-defined. - **TANGENT_LINEAR** = **1** --- The curve calculates the tangent on this side of the point as the slope halfway towards the adjacent point. - **TANGENT_MODE_COUNT** = **2** --- The total number of available tangent modes. Description ----------- A curve that can be saved and re-used for other objects. By default it ranges between ``0`` and ``1`` on the y-axis and positions points relative to the ``0.5`` y-position. Member Function Description --------------------------- .. _class_Curve_add_point: - :ref:`int` **add_point** **(** :ref:`Vector2` position, :ref:`float` left_tangent=0, :ref:`float` right_tangent=0, :ref:`int` left_mode=0, :ref:`int` right_mode=0 **)** Adds a point to the curve. For each side, if the ``*_mode`` is ``TANGENT_LINEAR``, the ``*_tangent`` angle (in degrees) uses the slope of the curve halfway to the adjacent point. Allows custom assignments to the ``*_tangent`` angle if ``*_mode`` is set to ``TANGENT_FREE``. .. _class_Curve_bake: - void **bake** **(** **)** Recomputes the baked cache of points for the curve. .. _class_Curve_clean_dupes: - void **clean_dupes** **(** **)** Removes points that are closer than ``CMP_EPSILON`` (0.00001) units to their neighbor on the curve. .. _class_Curve_clear_points: - void **clear_points** **(** **)** Removes all points from the curve. .. _class_Curve_get_point_left_mode: - :ref:`int` **get_point_left_mode** **(** :ref:`int` index **)** const Returns the left ``TangentMode`` for the point at ``index``. .. _class_Curve_get_point_left_tangent: - :ref:`float` **get_point_left_tangent** **(** :ref:`int` index **)** const Returns the left tangent angle (in degrees) for the point at ``index``. .. _class_Curve_get_point_position: - :ref:`Vector2` **get_point_position** **(** :ref:`int` index **)** const Returns the curve coordinates for the point at ``index``. .. _class_Curve_get_point_right_mode: - :ref:`int` **get_point_right_mode** **(** :ref:`int` index **)** const Returns the right ``TangentMode`` for the point at ``index``. .. _class_Curve_get_point_right_tangent: - :ref:`float` **get_point_right_tangent** **(** :ref:`int` index **)** const Returns the right tangent angle (in degrees) for the point at ``index``. .. _class_Curve_interpolate: - :ref:`float` **interpolate** **(** :ref:`float` offset **)** const Returns the y value for the point that would exist at x-position ``offset`` along the curve. .. _class_Curve_interpolate_baked: - :ref:`float` **interpolate_baked** **(** :ref:`float` offset **)** Returns the y value for the point that would exist at x-position ``offset`` along the curve using the baked cache. Bakes the curve's points if not already baked. .. _class_Curve_remove_point: - void **remove_point** **(** :ref:`int` index **)** Removes the point at ``index`` from the curve. .. _class_Curve_set_point_left_mode: - void **set_point_left_mode** **(** :ref:`int` index, :ref:`int` mode **)** Sets the left ``TangentMode`` for the point at ``index`` to ``mode``. .. _class_Curve_set_point_left_tangent: - void **set_point_left_tangent** **(** :ref:`int` index, :ref:`float` tangent **)** Sets the left tangent angle for the point at ``index`` to ``tangent``. .. _class_Curve_set_point_offset: - :ref:`int` **set_point_offset** **(** :ref:`int` index, :ref:`float` offset **)** Sets the offset from ``0.5`` .. _class_Curve_set_point_right_mode: - void **set_point_right_mode** **(** :ref:`int` index, :ref:`int` mode **)** Sets the right ``TangentMode`` for the point at ``index`` to ``mode``. .. _class_Curve_set_point_right_tangent: - void **set_point_right_tangent** **(** :ref:`int` index, :ref:`float` tangent **)** Sets the right tangent angle for the point at ``index`` to ``tangent``. .. _class_Curve_set_point_value: - void **set_point_value** **(** :ref:`int` index, :ref:`float` y **)** Assigns the vertical position ``y`` to the point at ``index``.