Curve

package
v0.0.0-...-a66c66c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package Curve provides methods for working with Curve object instances.

Index

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 Any

type Any interface {
	gd.IsClass
	AsCurve() Instance
}

type Expanded

type Expanded [1]gdclass.Curve

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 [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].

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

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]) AsCurve

func (self *Extension[T]) AsCurve() Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsResource

func (self *Extension[T]) AsResource() Resource.Instance

type ID

type ID Object.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.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.Curve

This resource describes a mathematical curve by defining a set of points and tangents at each point. By default, it ranges between [code]0[/code] and [code]1[/code] 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 [code]0[/code] and [code]1[/code]. Some examples of unit curve usage are [member CPUParticles2D.angle_curve] and [member Line2D.width_curve].

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddPoint

func (self Instance) AddPoint(position Vector2.XY) int

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].

func (Instance) AsCurve

func (self Instance) AsCurve() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) Bake

func (self Instance) Bake()

Recomputes the baked cache of points for the curve.

func (Instance) BakeResolution

func (self Instance) BakeResolution() int

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) ClearPoints

func (self Instance) ClearPoints()

Removes all points from the curve.

func (Instance) GetDomainRange

func (self Instance) GetDomainRange() Float.X

Returns the difference between [member min_domain] and [member max_domain].

func (Instance) GetPointLeftMode

func (self Instance) GetPointLeftMode(index int) TangentMode

Returns the left [enum TangentMode] for the point at [param index].

func (Instance) GetPointLeftTangent

func (self Instance) GetPointLeftTangent(index int) Float.X

Returns the left tangent angle (in degrees) for the point at [param index].

func (Instance) GetPointPosition

func (self Instance) GetPointPosition(index int) Vector2.XY

Returns the curve coordinates for the point at [param index].

func (Instance) GetPointRightMode

func (self Instance) GetPointRightMode(index int) TangentMode

Returns the right [enum TangentMode] for the point at [param index].

func (Instance) GetPointRightTangent

func (self Instance) GetPointRightTangent(index int) Float.X

Returns the right tangent angle (in degrees) for the point at [param index].

func (Instance) GetValueRange

func (self Instance) GetValueRange() Float.X

Returns the difference between [member min_value] and [member max_value].

func (Instance) ID

func (self Instance) ID() ID

func (Instance) MaxDomain

func (self Instance) MaxDomain() Float.X

func (Instance) MaxValue

func (self Instance) MaxValue() Float.X

func (Instance) MinDomain

func (self Instance) MinDomain() Float.X

func (Instance) MinValue

func (self Instance) MinValue() Float.X

func (Instance) OnDomainChanged

func (self Instance) OnDomainChanged(cb func(), flags ...Signal.Flags)

func (Instance) OnRangeChanged

func (self Instance) OnRangeChanged(cb func(), flags ...Signal.Flags)

func (Instance) PointCount

func (self Instance) PointCount() int

func (Instance) RemovePoint

func (self Instance) RemovePoint(index int)

Removes the point at [param index] from the curve.

func (Instance) Sample

func (self Instance) Sample(offset Float.X) Float.X

Returns the Y value for the point that would exist at the X position [param offset] along the curve.

func (Instance) SampleBaked

func (self Instance) SampleBaked(offset Float.X) Float.X

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.

func (Instance) SetBakeResolution

func (self Instance) SetBakeResolution(value int)

func (Instance) SetMaxDomain

func (self Instance) SetMaxDomain(value Float.X)

func (Instance) SetMaxValue

func (self Instance) SetMaxValue(value Float.X)

func (Instance) SetMinDomain

func (self Instance) SetMinDomain(value Float.X)

func (Instance) SetMinValue

func (self Instance) SetMinValue(value Float.X)

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetPointCount

func (self Instance) SetPointCount(value int)

func (Instance) SetPointLeftMode

func (self Instance) SetPointLeftMode(index int, mode TangentMode)

Sets the left [enum TangentMode] for the point at [param index] to [param mode].

func (Instance) SetPointLeftTangent

func (self Instance) SetPointLeftTangent(index int, tangent Float.X)

Sets the left tangent angle for the point at [param index] to [param tangent].

func (Instance) SetPointOffset

func (self Instance) SetPointOffset(index int, offset Float.X) int

Sets the offset from [code]0.5[/code].

func (Instance) SetPointRightMode

func (self Instance) SetPointRightMode(index int, mode TangentMode)

Sets the right [enum TangentMode] for the point at [param index] to [param mode].

func (Instance) SetPointRightTangent

func (self Instance) SetPointRightTangent(index int, tangent Float.X)

Sets the right tangent angle for the point at [param index] to [param tangent].

func (Instance) SetPointValue

func (self Instance) SetPointValue(index int, y Float.X)

Assigns the vertical position [param y] to the point at [param index].

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

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
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL