summaryrefslogtreecommitdiff
path: root/doc/classes/CPUParticles2D.xml
blob: 7119e231b2a1f3490fa6005ff990d395f9235d3f (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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CPUParticles2D" inherits="Node2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
	<brief_description>
		CPU-based 2D particle emitter.
	</brief_description>
	<description>
		CPU-based 2D particle node used to create a variety of particle systems and effects.
		See also [GPUParticles2D], which provides the same functionality with hardware acceleration, but may not run on older devices.
	</description>
	<tutorials>
		<link title="Particle systems (2D)">$DOCS_URL/tutorials/2d/particle_systems_2d.html</link>
	</tutorials>
	<methods>
		<method name="convert_from_particles">
			<return type="void" />
			<param index="0" name="particles" type="Node" />
			<description>
				Sets this node's properties to match a given [GPUParticles2D] node with an assigned [ParticleProcessMaterial].
			</description>
		</method>
		<method name="get_param_curve" qualifiers="const">
			<return type="Curve" />
			<param index="0" name="param" type="int" enum="CPUParticles2D.Parameter" />
			<description>
				Returns the [Curve] of the parameter specified by [enum Parameter].
			</description>
		</method>
		<method name="get_param_max" qualifiers="const">
			<return type="float" />
			<param index="0" name="param" type="int" enum="CPUParticles2D.Parameter" />
			<description>
				Returns the maximum value range for the given parameter.
			</description>
		</method>
		<method name="get_param_min" qualifiers="const">
			<return type="float" />
			<param index="0" name="param" type="int" enum="CPUParticles2D.Parameter" />
			<description>
				Returns the minimum value range for the given parameter.
			</description>
		</method>
		<method name="get_particle_flag" qualifiers="const">
			<return type="bool" />
			<param index="0" name="particle_flag" type="int" enum="CPUParticles2D.ParticleFlags" />
			<description>
				Returns the enabled state of the given flag (see [enum ParticleFlags] for options).
			</description>
		</method>
		<method name="restart">
			<return type="void" />
			<description>
				Restarts the particle emitter.
			</description>
		</method>
		<method name="set_param_curve">
			<return type="void" />
			<param index="0" name="param" type="int" enum="CPUParticles2D.Parameter" />
			<param index="1" name="curve" type="Curve" />
			<description>
				Sets the [Curve] of the parameter specified by [enum Parameter].
			</description>
		</method>
		<method name="set_param_max">
			<return type="void" />
			<param index="0" name="param" type="int" enum="CPUParticles2D.Parameter" />
			<param index="1" name="value" type="float" />
			<description>
				Sets the maximum value for the given parameter.
			</description>
		</method>
		<method name="set_param_min">
			<return type="void" />
			<param index="0" name="param" type="int" enum="CPUParticles2D.Parameter" />
			<param index="1" name="value" type="float" />
			<description>
				Sets the minimum value for the given parameter.
			</description>
		</method>
		<method name="set_particle_flag">
			<return type="void" />
			<param index="0" name="particle_flag" type="int" enum="CPUParticles2D.ParticleFlags" />
			<param index="1" name="enable" type="bool" />
			<description>
				Enables or disables the given flag (see [enum ParticleFlags] for options).
			</description>
		</method>
	</methods>
	<members>
		<member name="amount" type="int" setter="set_amount" getter="get_amount" default="8">
			Number of particles emitted in one emission cycle.
		</member>
		<member name="angle_curve" type="Curve" setter="set_param_curve" getter="get_param_curve">
			Each particle's rotation will be animated along this [Curve].
		</member>
		<member name="angle_max" type="float" setter="set_param_max" getter="get_param_max" default="0.0">
			Maximum initial rotation applied to each particle, in degrees.
		</member>
		<member name="angle_min" type="float" setter="set_param_min" getter="get_param_min" default="0.0">
			Minimum equivalent of [member angle_max].
		</member>
		<member name="angular_velocity_curve" type="Curve" setter="set_param_curve" getter="get_param_curve">
			Each particle's angular velocity will vary along this [Curve].
		</member>
		<member name="angular_velocity_max" type="float" setter="set_param_max" getter="get_param_max" default="0.0">
			Maximum initial angular velocity (rotation speed) applied to each particle in [i]degrees[/i] per second.
		</member>
		<member name="angular_velocity_min" type="float" setter="set_param_min" getter="get_param_min" default="0.0">
			Minimum equivalent of [member angular_velocity_max].
		</member>
		<member name="anim_offset_curve" type="Curve" setter="set_param_curve" getter="get_param_curve">
			Each particle's animation offset will vary along this [Curve].
		</member>
		<member name="anim_offset_max" type="float" setter="set_param_max" getter="get_param_max" default="0.0">
			Maximum animation offset that corresponds to frame index in the texture. [code]0[/code] is the first frame, [code]1[/code] is the last one. See [member CanvasItemMaterial.particles_animation].
		</member>
		<member name="anim_offset_min" type="float" setter="set_param_min" getter="get_param_min" default="0.0">
			Minimum equivalent of [member anim_offset_max].
		</member>
		<member name="anim_speed_curve" type="Curve" setter="set_param_curve" getter="get_param_curve">
			Each particle's animation speed will vary along this [Curve].
		</member>
		<member name="anim_speed_max" type="float" setter="set_param_max" getter="get_param_max" default="0.0">
			Maximum particle animation speed. Animation speed of [code]1[/code] means that the particles will make full [code]0[/code] to [code]1[/code] offset cycle during lifetime, [code]2[/code] means [code]2[/code] cycles etc.
			With animation speed greater than [code]1[/code], remember to enable [member CanvasItemMaterial.particles_anim_loop] property if you want the animation to repeat.
		</member>
		<member name="anim_speed_min" type="float" setter="set_param_min" getter="get_param_min" default="0.0">
			Minimum equivalent of [member anim_speed_max].
		</member>
		<member name="color" type="Color" setter="set_color" getter="get_color" default="Color(1, 1, 1, 1)">
			Each particle's initial color. If [member texture] is defined, it will be multiplied by this color.
		</member>
		<member name="color_initial_ramp" type="Gradient" setter="set_color_initial_ramp" getter="get_color_initial_ramp">
			Each particle's initial color will vary along this [GradientTexture1D] (multiplied with [member color]).
		</member>
		<member name="color_ramp" type="Gradient" setter="set_color_ramp" getter="get_color_ramp">
			Each particle's color will vary along this [Gradient] (multiplied with [member color]).
		</member>
		<member name="damping_curve" type="Curve" setter="set_param_curve" getter="get_param_curve">
			Damping will vary along this [Curve].
		</member>
		<member name="damping_max" type="float" setter="set_param_max" getter="get_param_max" default="0.0">
			The maximum rate at which particles lose velocity. For example value of [code]100[/code] means that the particle will go from [code]100[/code] velocity to [code]0[/code] in [code]1[/code] second.
		</member>
		<member name="damping_min" type="float" setter="set_param_min" getter="get_param_min" default="0.0">
			Minimum equivalent of [member damping_max].
		</member>
		<member name="direction" type="Vector2" setter="set_direction" getter="get_direction" default="Vector2(1, 0)">
			Unit vector specifying the particles' emission direction.
		</member>
		<member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="CPUParticles2D.DrawOrder" default="0">
			Particle draw order. Uses [enum DrawOrder] values.
		</member>
		<member name="emission_colors" type="PackedColorArray" setter="set_emission_colors" getter="get_emission_colors">
			Sets the [Color]s to modulate particles by when using [constant EMISSION_SHAPE_POINTS] or [constant EMISSION_SHAPE_DIRECTED_POINTS].
		</member>
		<member name="emission_normals" type="PackedVector2Array" setter="set_emission_normals" getter="get_emission_normals">
			Sets the direction the particles will be emitted in when using [constant EMISSION_SHAPE_DIRECTED_POINTS].
		</member>
		<member name="emission_points" type="PackedVector2Array" setter="set_emission_points" getter="get_emission_points">
			Sets the initial positions to spawn particles when using [constant EMISSION_SHAPE_POINTS] or [constant EMISSION_SHAPE_DIRECTED_POINTS].
		</member>
		<member name="emission_rect_extents" type="Vector2" setter="set_emission_rect_extents" getter="get_emission_rect_extents">
			The rectangle's extents if [member emission_shape] is set to [constant EMISSION_SHAPE_RECTANGLE].
		</member>
		<member name="emission_shape" type="int" setter="set_emission_shape" getter="get_emission_shape" enum="CPUParticles2D.EmissionShape" default="0">
			Particles will be emitted inside this region. See [enum EmissionShape] for possible values.
		</member>
		<member name="emission_sphere_radius" type="float" setter="set_emission_sphere_radius" getter="get_emission_sphere_radius">
			The sphere's radius if [member emission_shape] is set to [constant EMISSION_SHAPE_SPHERE].
		</member>
		<member name="emitting" type="bool" setter="set_emitting" getter="is_emitting" default="true">
			If [code]true[/code], particles are being emitted.
		</member>
		<member name="explosiveness" type="float" setter="set_explosiveness_ratio" getter="get_explosiveness_ratio" default="0.0">
			How rapidly particles in an emission cycle are emitted. If greater than [code]0[/code], there will be a gap in emissions before the next cycle begins.
		</member>
		<member name="fixed_fps" type="int" setter="set_fixed_fps" getter="get_fixed_fps" default="0">
			The particle system's frame rate is fixed to a value. For instance, changing the value to 2 will make the particles render at 2 frames per second. Note this does not slow down the simulation of the particle system itself.
		</member>
		<member name="fract_delta" type="bool" setter="set_fractional_delta" getter="get_fractional_delta" default="true">
			If [code]true[/code], results in fractional delta calculation which has a smoother particles display effect.
		</member>
		<member name="gravity" type="Vector2" setter="set_gravity" getter="get_gravity" default="Vector2(0, 980)">
			Gravity applied to every particle.
		</member>
		<member name="hue_variation_curve" type="Curve" setter="set_param_curve" getter="get_param_curve">
			Each particle's hue will vary along this [Curve].
		</member>
		<member name="hue_variation_max" type="float" setter="set_param_max" getter="get_param_max" default="0.0">
			Maximum initial hue variation applied to each particle. It will shift the particle color's hue.
		</member>
		<member name="hue_variation_min" type="float" setter="set_param_min" getter="get_param_min" default="0.0">
			Minimum equivalent of [member hue_variation_max].
		</member>
		<member name="initial_velocity_max" type="float" setter="set_param_max" getter="get_param_max" default="0.0">
			Maximum initial velocity magnitude for each particle. Direction comes from [member direction] and [member spread].
		</member>
		<member name="initial_velocity_min" type="float" setter="set_param_min" getter="get_param_min" default="0.0">
			Minimum equivalent of [member initial_velocity_max].
		</member>
		<member name="lifetime" type="float" setter="set_lifetime" getter="get_lifetime" default="1.0">
			Amount of time each particle will exist.
		</member>
		<member name="lifetime_randomness" type="float" setter="set_lifetime_randomness" getter="get_lifetime_randomness" default="0.0">
			Particle lifetime randomness ratio.
		</member>
		<member name="linear_accel_curve" type="Curve" setter="set_param_curve" getter="get_param_curve">
			Each particle's linear acceleration will vary along this [Curve].
		</member>
		<member name="linear_accel_max" type="float" setter="set_param_max" getter="get_param_max" default="0.0">
			Maximum linear acceleration applied to each particle in the direction of motion.
		</member>
		<member name="linear_accel_min" type="float" setter="set_param_min" getter="get_param_min" default="0.0">
			Minimum equivalent of [member linear_accel_max].
		</member>
		<member name="local_coords" type="bool" setter="set_use_local_coordinates" getter="get_use_local_coordinates" default="false">
			If [code]true[/code], particles use the parent node's coordinate space (known as local coordinates). This will cause particles to move and rotate along the [CPUParticles2D] node (and its parents) when it is moved or rotated. If [code]false[/code], particles use global coordinates; they will not move or rotate along the [CPUParticles2D] node (and its parents) when it is moved or rotated.
		</member>
		<member name="one_shot" type="bool" setter="set_one_shot" getter="get_one_shot" default="false">
			If [code]true[/code], only one emission cycle occurs. If set [code]true[/code] during a cycle, emission will stop at the cycle's end.
		</member>
		<member name="orbit_velocity_curve" type="Curve" setter="set_param_curve" getter="get_param_curve">
			Each particle's orbital velocity will vary along this [Curve].
		</member>
		<member name="orbit_velocity_max" type="float" setter="set_param_max" getter="get_param_max" default="0.0">
			Maximum orbital velocity applied to each particle. Makes the particles circle around origin. Specified in number of full rotations around origin per second.
		</member>
		<member name="orbit_velocity_min" type="float" setter="set_param_min" getter="get_param_min" default="0.0">
			Minimum equivalent of [member orbit_velocity_max].
		</member>
		<member name="particle_flag_align_y" type="bool" setter="set_particle_flag" getter="get_particle_flag" default="false">
			Align Y axis of particle with the direction of its velocity.
		</member>
		<member name="preprocess" type="float" setter="set_pre_process_time" getter="get_pre_process_time" default="0.0">
			Particle system starts as if it had already run for this many seconds.
		</member>
		<member name="radial_accel_curve" type="Curve" setter="set_param_curve" getter="get_param_curve">
			Each particle's radial acceleration will vary along this [Curve].
		</member>
		<member name="radial_accel_max" type="float" setter="set_param_max" getter="get_param_max" default="0.0">
			Maximum radial acceleration applied to each particle. Makes particle accelerate away from the origin or towards it if negative.
		</member>
		<member name="radial_accel_min" type="float" setter="set_param_min" getter="get_param_min" default="0.0">
			Minimum equivalent of [member radial_accel_max].
		</member>
		<member name="randomness" type="float" setter="set_randomness_ratio" getter="get_randomness_ratio" default="0.0">
			Emission lifetime randomness ratio.
		</member>
		<member name="scale_amount_curve" type="Curve" setter="set_param_curve" getter="get_param_curve">
			Each particle's scale will vary along this [Curve].
		</member>
		<member name="scale_amount_max" type="float" setter="set_param_max" getter="get_param_max" default="1.0">
			Maximum initial scale applied to each particle.
		</member>
		<member name="scale_amount_min" type="float" setter="set_param_min" getter="get_param_min" default="1.0">
			Minimum equivalent of [member scale_amount_max].
		</member>
		<member name="scale_curve_x" type="Curve" setter="set_scale_curve_x" getter="get_scale_curve_x">
			Each particle's horizontal scale will vary along this [Curve].
			[member split_scale] must be enabled.
		</member>
		<member name="scale_curve_y" type="Curve" setter="set_scale_curve_y" getter="get_scale_curve_y">
			Each particle's vertical scale will vary along this [Curve].
			[member split_scale] must be enabled.
		</member>
		<member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0">
			Particle system's running speed scaling ratio. A value of [code]0[/code] can be used to pause the particles.
		</member>
		<member name="split_scale" type="bool" setter="set_split_scale" getter="get_split_scale" default="false">
			If [code]true[/code], the scale curve will be split into x and y components. See [member scale_curve_x] and [member scale_curve_y].
		</member>
		<member name="spread" type="float" setter="set_spread" getter="get_spread" default="45.0">
			Each particle's initial direction range from [code]+spread[/code] to [code]-spread[/code] degrees.
		</member>
		<member name="tangential_accel_curve" type="Curve" setter="set_param_curve" getter="get_param_curve">
			Each particle's tangential acceleration will vary along this [Curve].
		</member>
		<member name="tangential_accel_max" type="float" setter="set_param_max" getter="get_param_max" default="0.0">
			Maximum tangential acceleration applied to each particle. Tangential acceleration is perpendicular to the particle's velocity giving the particles a swirling motion.
		</member>
		<member name="tangential_accel_min" type="float" setter="set_param_min" getter="get_param_min" default="0.0">
			Minimum equivalent of [member tangential_accel_max].
		</member>
		<member name="texture" type="Texture2D" setter="set_texture" getter="get_texture">
			Particle texture. If [code]null[/code], particles will be squares.
		</member>
	</members>
	<constants>
		<constant name="DRAW_ORDER_INDEX" value="0" enum="DrawOrder">
			Particles are drawn in the order emitted.
		</constant>
		<constant name="DRAW_ORDER_LIFETIME" value="1" enum="DrawOrder">
			Particles are drawn in order of remaining lifetime.
		</constant>
		<constant name="PARAM_INITIAL_LINEAR_VELOCITY" value="0" enum="Parameter">
			Use with [method set_param_min], [method set_param_max], and [method set_param_curve] to set initial velocity properties.
		</constant>
		<constant name="PARAM_ANGULAR_VELOCITY" value="1" enum="Parameter">
			Use with [method set_param_min], [method set_param_max], and [method set_param_curve] to set angular velocity properties.
		</constant>
		<constant name="PARAM_ORBIT_VELOCITY" value="2" enum="Parameter">
			Use with [method set_param_min], [method set_param_max], and [method set_param_curve] to set orbital velocity properties.
		</constant>
		<constant name="PARAM_LINEAR_ACCEL" value="3" enum="Parameter">
			Use with [method set_param_min], [method set_param_max], and [method set_param_curve] to set linear acceleration properties.
		</constant>
		<constant name="PARAM_RADIAL_ACCEL" value="4" enum="Parameter">
			Use with [method set_param_min], [method set_param_max], and [method set_param_curve] to set radial acceleration properties.
		</constant>
		<constant name="PARAM_TANGENTIAL_ACCEL" value="5" enum="Parameter">
			Use with [method set_param_min], [method set_param_max], and [method set_param_curve] to set tangential acceleration properties.
		</constant>
		<constant name="PARAM_DAMPING" value="6" enum="Parameter">
			Use with [method set_param_min], [method set_param_max], and [method set_param_curve] to set damping properties.
		</constant>
		<constant name="PARAM_ANGLE" value="7" enum="Parameter">
			Use with [method set_param_min], [method set_param_max], and [method set_param_curve] to set angle properties.
		</constant>
		<constant name="PARAM_SCALE" value="8" enum="Parameter">
			Use with [method set_param_min], [method set_param_max], and [method set_param_curve] to set scale properties.
		</constant>
		<constant name="PARAM_HUE_VARIATION" value="9" enum="Parameter">
			Use with [method set_param_min], [method set_param_max], and [method set_param_curve] to set hue variation properties.
		</constant>
		<constant name="PARAM_ANIM_SPEED" value="10" enum="Parameter">
			Use with [method set_param_min], [method set_param_max], and [method set_param_curve] to set animation speed properties.
		</constant>
		<constant name="PARAM_ANIM_OFFSET" value="11" enum="Parameter">
			Use with [method set_param_min], [method set_param_max], and [method set_param_curve] to set animation offset properties.
		</constant>
		<constant name="PARAM_MAX" value="12" enum="Parameter">
			Represents the size of the [enum Parameter] enum.
		</constant>
		<constant name="PARTICLE_FLAG_ALIGN_Y_TO_VELOCITY" value="0" enum="ParticleFlags">
			Use with [method set_particle_flag] to set [member particle_flag_align_y].
		</constant>
		<constant name="PARTICLE_FLAG_ROTATE_Y" value="1" enum="ParticleFlags">
			Present for consistency with 3D particle nodes, not used in 2D.
		</constant>
		<constant name="PARTICLE_FLAG_DISABLE_Z" value="2" enum="ParticleFlags">
			Present for consistency with 3D particle nodes, not used in 2D.
		</constant>
		<constant name="PARTICLE_FLAG_MAX" value="3" enum="ParticleFlags">
			Represents the size of the [enum ParticleFlags] enum.
		</constant>
		<constant name="EMISSION_SHAPE_POINT" value="0" enum="EmissionShape">
			All particles will be emitted from a single point.
		</constant>
		<constant name="EMISSION_SHAPE_SPHERE" value="1" enum="EmissionShape">
			Particles will be emitted in the volume of a sphere flattened to two dimensions.
		</constant>
		<constant name="EMISSION_SHAPE_SPHERE_SURFACE" value="2" enum="EmissionShape">
			Particles will be emitted on the surface of a sphere flattened to two dimensions.
		</constant>
		<constant name="EMISSION_SHAPE_RECTANGLE" value="3" enum="EmissionShape">
			Particles will be emitted in the area of a rectangle.
		</constant>
		<constant name="EMISSION_SHAPE_POINTS" value="4" enum="EmissionShape">
			Particles will be emitted at a position chosen randomly among [member emission_points]. Particle color will be modulated by [member emission_colors].
		</constant>
		<constant name="EMISSION_SHAPE_DIRECTED_POINTS" value="5" enum="EmissionShape">
			Particles will be emitted at a position chosen randomly among [member emission_points]. Particle velocity and rotation will be set based on [member emission_normals]. Particle color will be modulated by [member emission_colors].
		</constant>
		<constant name="EMISSION_SHAPE_MAX" value="6" enum="EmissionShape">
			Represents the size of the [enum EmissionShape] enum.
		</constant>
	</constants>
</class>