Documentation
¶
Overview ¶
This resource describes a mathematical curve by defining a set of points and tangents at each point. By default, it ranges between 0 and 1 on the X and Y axes, but these ranges can be changed. Please note that many resources and nodes assume they are given [i]unit curves[/i]. A unit curve is a curve whose domain (the X axis) is between 0 and 1. Some examples of unit curve usage are [member CPUParticles2D.angle_curve] and [member Line2D.width_curve].
Index ¶
- type Advanced
- type Any
- type Expanded
- type Extension
- type ID
- type Instance
- func (self Instance) AddPoint(position Vector2.XY) int
- func (self Instance) AsCurve() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) Bake()
- func (self Instance) BakeResolution() int
- func (self Instance) CleanDupes()
- func (self Instance) ClearPoints()
- func (self Instance) GetDomainRange() Float.X
- func (self Instance) GetPointLeftMode(index int) TangentMode
- func (self Instance) GetPointLeftTangent(index int) Float.X
- func (self Instance) GetPointPosition(index int) Vector2.XY
- func (self Instance) GetPointRightMode(index int) TangentMode
- func (self Instance) GetPointRightTangent(index int) Float.X
- func (self Instance) GetValueRange() Float.X
- func (self Instance) ID() ID
- func (self Instance) MaxDomain() Float.X
- func (self Instance) MaxValue() Float.X
- func (self Instance) MinDomain() Float.X
- func (self Instance) MinValue() Float.X
- func (self Instance) OnDomainChanged(cb func(), flags ...Signal.Flags)
- func (self Instance) OnRangeChanged(cb func(), flags ...Signal.Flags)
- func (self Instance) PointCount() int
- func (self Instance) RemovePoint(index int)
- func (self Instance) Sample(offset Float.X) Float.X
- func (self Instance) SampleBaked(offset Float.X) Float.X
- func (self Instance) SetBakeResolution(value int)
- func (self Instance) SetMaxDomain(value Float.X)
- func (self Instance) SetMaxValue(value Float.X)
- func (self Instance) SetMinDomain(value Float.X)
- func (self Instance) SetMinValue(value Float.X)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetPointCount(value int)
- func (self Instance) SetPointLeftMode(index int, mode TangentMode)
- func (self Instance) SetPointLeftTangent(index int, tangent Float.X)
- func (self Instance) SetPointOffset(index int, offset Float.X) int
- func (self Instance) SetPointRightMode(index int, mode TangentMode)
- func (self Instance) SetPointRightTangent(index int, tangent Float.X)
- func (self Instance) SetPointValue(index int, y Float.X)
- func (self Instance) Virtual(name string) reflect.Value
- type TangentMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Expanded ¶
func (Expanded) AddPoint ¶
func (self Expanded) AddPoint(position Vector2.XY, left_tangent Float.X, right_tangent Float.X, left_mode TangentMode, right_mode TangentMode) int
Adds a point to the curve. For each side, if the *_mode is TangentLinear, 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 TangentFree.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsResource ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AddPoint ¶
Adds a point to the curve. For each side, if the *_mode is TangentLinear, 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 TangentFree.
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) Bake ¶
func (self Instance) Bake()
Recomputes the baked cache of points for the curve.
func (Instance) BakeResolution ¶
func (Instance) CleanDupes ¶
func (self Instance) CleanDupes()
Removes duplicate points, i.e. points that are less than 0.00001 units (engine epsilon value) away from their neighbor on the curve.
func (Instance) GetDomainRange ¶
Returns the difference between [member min_domain] and [member max_domain].
func (Instance) GetPointLeftMode ¶
func (self Instance) GetPointLeftMode(index int) TangentMode
Returns the left TangentMode for the point at 'index'.
func (Instance) GetPointLeftTangent ¶
Returns the left tangent angle (in degrees) for the point at 'index'.
func (Instance) GetPointPosition ¶
Returns the curve coordinates for the point at 'index'.
func (Instance) GetPointRightMode ¶
func (self Instance) GetPointRightMode(index int) TangentMode
Returns the right TangentMode for the point at 'index'.
func (Instance) GetPointRightTangent ¶
Returns the right tangent angle (in degrees) for the point at 'index'.
func (Instance) GetValueRange ¶
Returns the difference between [member min_value] and [member max_value].
func (Instance) OnDomainChanged ¶
func (Instance) OnRangeChanged ¶
func (Instance) PointCount ¶
func (Instance) RemovePoint ¶
Removes the point at 'index' from the curve.
func (Instance) Sample ¶
Returns the Y value for the point that would exist at the X position 'offset' along the curve.
func (Instance) SampleBaked ¶
Returns the Y value for the point that would exist at the X position 'offset' along the curve using the baked cache. Bakes the curve's points if not already baked.
func (Instance) SetBakeResolution ¶
func (Instance) SetMaxDomain ¶
func (Instance) SetMaxValue ¶
func (Instance) SetMinDomain ¶
func (Instance) SetMinValue ¶
func (Instance) SetPointCount ¶
func (Instance) SetPointLeftMode ¶
func (self Instance) SetPointLeftMode(index int, mode TangentMode)
Sets the left TangentMode for the point at 'index' to 'mode'.
func (Instance) SetPointLeftTangent ¶
Sets the left tangent angle for the point at 'index' to 'tangent'.
func (Instance) SetPointOffset ¶
Sets the offset from 0.5.
func (Instance) SetPointRightMode ¶
func (self Instance) SetPointRightMode(index int, mode TangentMode)
Sets the right TangentMode for the point at 'index' to 'mode'.
func (Instance) SetPointRightTangent ¶
Sets the right tangent angle for the point at 'index' to 'tangent'.
func (Instance) SetPointValue ¶
Assigns the vertical position 'y' to the point at 'index'.
type TangentMode ¶
type TangentMode int //gd:Curve.TangentMode
const ( /*The tangent on this side of the point is user-defined.*/ TangentFree TangentMode = 0 /*The curve calculates the tangent on this side of the point as the slope halfway towards the adjacent point.*/ TangentLinear TangentMode = 1 /*The total number of available tangent modes.*/ TangentModeCount TangentMode = 2 )