summaryrefslogtreecommitdiff
path: root/doc/classes/Curve.xml
blob: 388d8ab54f69fdffc67c127a7c744ccd7b73b36a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Curve" inherits="Resource" category="Core" version="3.0-stable">
	<brief_description>
		A mathematic curve.
	</brief_description>
	<description>
		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.
	</description>
	<tutorials>
	</tutorials>
	<demos>
	</demos>
	<methods>
		<method name="add_point">
			<return type="int">
			</return>
			<argument index="0" name="position" type="Vector2">
			</argument>
			<argument index="1" name="left_tangent" type="float" default="0">
			</argument>
			<argument index="2" name="right_tangent" type="float" default="0">
			</argument>
			<argument index="3" name="left_mode" type="int" enum="Curve.TangentMode" default="0">
			</argument>
			<argument index="4" name="right_mode" type="int" enum="Curve.TangentMode" default="0">
			</argument>
			<description>
				Adds a point to the curve. For each side, if the [code]*_mode[/code] is [code]TANGENT_LINEAR[/code], 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 [code]TANGENT_FREE[/code].
			</description>
		</method>
		<method name="bake">
			<return type="void">
			</return>
			<description>
				Recomputes the baked cache of points for the curve.
			</description>
		</method>
		<method name="clean_dupes">
			<return type="void">
			</return>
			<description>
				Removes points that are closer than [code]CMP_EPSILON[/code] (0.00001) units to their neighbor on the curve.
			</description>
		</method>
		<method name="clear_points">
			<return type="void">
			</return>
			<description>
				Removes all points from the curve.
			</description>
		</method>
		<method name="get_point_left_mode" qualifiers="const">
			<return type="int" enum="Curve.TangentMode">
			</return>
			<argument index="0" name="index" type="int">
			</argument>
			<description>
				Returns the left [code]TangentMode[/code] for the point at [code]index[/code].
			</description>
		</method>
		<method name="get_point_left_tangent" qualifiers="const">
			<return type="float">
			</return>
			<argument index="0" name="index" type="int">
			</argument>
			<description>
				Returns the left tangent angle (in degrees) for the point at [code]index[/code].
			</description>
		</method>
		<method name="get_point_position" qualifiers="const">
			<return type="Vector2">
			</return>
			<argument index="0" name="index" type="int">
			</argument>
			<description>
				Returns the curve coordinates for the point at [code]index[/code].
			</description>
		</method>
		<method name="get_point_right_mode" qualifiers="const">
			<return type="int" enum="Curve.TangentMode">
			</return>
			<argument index="0" name="index" type="int">
			</argument>
			<description>
				Returns the right [code]TangentMode[/code] for the point at [code]index[/code].
			</description>
		</method>
		<method name="get_point_right_tangent" qualifiers="const">
			<return type="float">
			</return>
			<argument index="0" name="index" type="int">
			</argument>
			<description>
				Returns the right tangent angle (in degrees) for the point at [code]index[/code].
			</description>
		</method>
		<method name="interpolate" qualifiers="const">
			<return type="float">
			</return>
			<argument index="0" name="offset" type="float">
			</argument>
			<description>
				Returns the y value for the point that would exist at x-position [code]offset[/code] along the curve.
			</description>
		</method>
		<method name="interpolate_baked">
			<return type="float">
			</return>
			<argument index="0" name="offset" type="float">
			</argument>
			<description>
				Returns the y value for the point that would exist at x-position [code]offset[/code] along the curve using the baked cache. Bakes the curve's points if not already baked.
			</description>
		</method>
		<method name="remove_point">
			<return type="void">
			</return>
			<argument index="0" name="index" type="int">
			</argument>
			<description>
				Removes the point at [code]index[/code] from the curve.
			</description>
		</method>
		<method name="set_point_left_mode">
			<return type="void">
			</return>
			<argument index="0" name="index" type="int">
			</argument>
			<argument index="1" name="mode" type="int" enum="Curve.TangentMode">
			</argument>
			<description>
				Sets the left [code]TangentMode[/code] for the point at [code]index[/code] to [code]mode[/code].
			</description>
		</method>
		<method name="set_point_left_tangent">
			<return type="void">
			</return>
			<argument index="0" name="index" type="int">
			</argument>
			<argument index="1" name="tangent" type="float">
			</argument>
			<description>
				Sets the left tangent angle for the point at [code]index[/code] to [code]tangent[/code].
			</description>
		</method>
		<method name="set_point_offset">
			<return type="int">
			</return>
			<argument index="0" name="index" type="int">
			</argument>
			<argument index="1" name="offset" type="float">
			</argument>
			<description>
				Sets the offset from [code]0.5[/code]
			</description>
		</method>
		<method name="set_point_right_mode">
			<return type="void">
			</return>
			<argument index="0" name="index" type="int">
			</argument>
			<argument index="1" name="mode" type="int" enum="Curve.TangentMode">
			</argument>
			<description>
				Sets the right [code]TangentMode[/code] for the point at [code]index[/code] to [code]mode[/code].
			</description>
		</method>
		<method name="set_point_right_tangent">
			<return type="void">
			</return>
			<argument index="0" name="index" type="int">
			</argument>
			<argument index="1" name="tangent" type="float">
			</argument>
			<description>
				Sets the right tangent angle for the point at [code]index[/code] to [code]tangent[/code].
			</description>
		</method>
		<method name="set_point_value">
			<return type="void">
			</return>
			<argument index="0" name="index" type="int">
			</argument>
			<argument index="1" name="y" type="float">
			</argument>
			<description>
				Assigns the vertical position [code]y[/code] to the point at [code]index[/code].
			</description>
		</method>
	</methods>
	<members>
		<member name="bake_resolution" type="int" setter="set_bake_resolution" getter="get_bake_resolution">
			The number of points to include in the baked (i.e. cached) curve data.
		</member>
		<member name="max_value" type="float" setter="set_max_value" getter="get_max_value">
			The maximum value the curve can reach. Default value: [code]1[/code].
		</member>
		<member name="min_value" type="float" setter="set_min_value" getter="get_min_value">
			The minimum value the curve can reach. Default value: [code]0[/code].
		</member>
	</members>
	<signals>
		<signal name="range_changed">
			<description>
				Emitted when [member max_value] or [member min_value] is changed.
			</description>
		</signal>
	</signals>
	<constants>
		<constant name="TANGENT_FREE" value="0" enum="TangentMode">
			The tangent on this side of the point is user-defined.
		</constant>
		<constant name="TANGENT_LINEAR" value="1" enum="TangentMode">
			The curve calculates the tangent on this side of the point as the slope halfway towards the adjacent point.
		</constant>
		<constant name="TANGENT_MODE_COUNT" value="2" enum="TangentMode">
			The total number of available tangent modes.
		</constant>
	</constants>
</class>