Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
- AnimationMixer (2)
- AudioStreamPlayer
- CanvasItem (2)
- CanvasLayer (1)
- EditorFileSystem
- EditorPlugin (1)
- EditorResourcePreview
- HTTPRequest
- InstancePlaceholder
- MissingNode
- MultiplayerSpawner
- MultiplayerSynchronizer
- NavigationAgent2D
- NavigationAgent3D
- Node3D (31)
- ResourcePreloader
- ShaderGlobalsOverride
- StatusIndicator
- Timer
- Viewport (2)
- WorldEnvironment
- AnimatedSprite2D
- AudioListener2D
- AudioStreamPlayer2D
- BackBufferCopy
- Bone2D
- CPUParticles2D
- Camera2D
- CanvasGroup
- CanvasModulate
- CollisionObject2D (2)
- CollisionPolygon2D
- CollisionShape2D
- GPUParticles2D
- Joint2D (3)
- Light2D (2)
- LightOccluder2D
- Line2D
- Marker2D
- MeshInstance2D
- MultiMeshInstance2D
- NavigationLink2D
- NavigationObstacle2D
- NavigationRegion2D
- Parallax2D
- ParallaxLayer
- Path2D
- PathFollow2D
- Polygon2D
- RayCast2D
- RemoteTransform2D
- ShapeCast2D
- Skeleton2D
- Sprite2D
- TileMap
- TileMapLayer
- TouchScreenButton
- VisibleOnScreenNotifier2D (1)
Table of contents
-
var amount: int = 8 -
var angle_curve: Curve -
var angle_max: float = 0.0 -
var angle_min: float = 0.0 -
var angular_velocity_curve: Curve -
var angular_velocity_max: float = 0.0 -
var angular_velocity_min: float = 0.0 -
var anim_offset_curve: Curve -
var anim_offset_max: float = 0.0 -
var anim_offset_min: float = 0.0 -
var anim_speed_curve: Curve -
var anim_speed_max: float = 0.0 -
var anim_speed_min: float = 0.0 -
var color: Color = Color(1, 1, 1, 1) -
var color_initial_ramp: Gradient -
var color_ramp: Gradient -
var damping_curve: Curve -
var damping_max: float = 0.0 -
var damping_min: float = 0.0 -
var direction: Vector2 = Vector2(1, 0) -
var draw_order = DRAW_ORDER_INDEX -
var emission_colors: PackedColorArray -
var emission_normals: PackedVector2Array -
var emission_points: PackedVector2Array -
var emission_rect_extents: Vector2 -
var emission_shape = EMISSION_SHAPE_POINT -
var emission_sphere_radius: float -
var emitting: bool = true -
var explosiveness: float = 0.0 -
var fixed_fps: int = 0 -
var fract_delta: bool = true -
var gravity: Vector2 = Vector2(0, 980) -
var hue_variation_curve: Curve -
var hue_variation_max: float = 0.0 -
var hue_variation_min: float = 0.0 -
var initial_velocity_max: float = 0.0 -
var initial_velocity_min: float = 0.0 -
var lifetime: float = 1.0 -
var lifetime_randomness: float = 0.0 -
var linear_accel_curve: Curve -
var linear_accel_max: float = 0.0 -
var linear_accel_min: float = 0.0 -
var local_coords: bool = false -
var one_shot: bool = false -
var orbit_velocity_curve: Curve -
var orbit_velocity_max: float = 0.0 -
var orbit_velocity_min: float = 0.0 -
var particle_flag_align_y: bool = false -
var physics_interpolation_mode = PHYSICS_INTERPOLATION_MODE_OFF -
var preprocess: float = 0.0 -
var radial_accel_curve: Curve -
var radial_accel_max: float = 0.0 -
var radial_accel_min: float = 0.0 -
var randomness: float = 0.0 -
var scale_amount_curve: Curve -
var scale_amount_max: float = 1.0 -
var scale_amount_min: float = 1.0 -
var scale_curve_x: Curve -
var scale_curve_y: Curve -
var seed: int = 0 -
var speed_scale: float = 1.0 -
var split_scale: bool = false -
var spread: float = 45.0 -
var tangential_accel_curve: Curve -
var tangential_accel_max: float = 0.0 -
var tangential_accel_min: float = 0.0 -
var texture: Texture2D -
var use_fixed_seed: bool = false -
func convert_from_particles(particles: Node) -> void -
const func get_param_curve(param: int enumCPUParticles2D.Parameter) -> Curve -
const func get_param_max(param: int enumCPUParticles2D.Parameter) -> float -
const func get_param_min(param: int enumCPUParticles2D.Parameter) -> float -
const func get_particle_flag(particle_flag: int enumCPUParticles2D.ParticleFlags) -> bool -
func request_particles_process(process_time: float) -> void -
func restart(keep_seed: bool = false) -> void -
func set_param_curve(curve: Curve) -> void -
func set_param_max(value: float) -> void -
func set_param_min(value: float) -> void -
func set_particle_flag(enable: bool) -> void -
const DRAW_ORDER_INDEX = 0 enum DrawOrder -
const DRAW_ORDER_LIFETIME = 1 enum DrawOrder -
const PARAM_INITIAL_LINEAR_VELOCITY = 0 enum Parameter -
const PARAM_ANGULAR_VELOCITY = 1 enum Parameter -
const PARAM_ORBIT_VELOCITY = 2 enum Parameter -
const PARAM_LINEAR_ACCEL = 3 enum Parameter -
const PARAM_RADIAL_ACCEL = 4 enum Parameter -
const PARAM_TANGENTIAL_ACCEL = 5 enum Parameter -
const PARAM_DAMPING = 6 enum Parameter -
const PARAM_ANGLE = 7 enum Parameter -
const PARAM_SCALE = 8 enum Parameter -
const PARAM_HUE_VARIATION = 9 enum Parameter -
const PARAM_ANIM_SPEED = 10 enum Parameter -
const PARAM_ANIM_OFFSET = 11 enum Parameter -
const PARAM_MAX = 12 enum Parameter -
const PARTICLE_FLAG_ALIGN_Y_TO_VELOCITY = 0 enum ParticleFlags -
const PARTICLE_FLAG_ROTATE_Y = 1 enum ParticleFlags -
const PARTICLE_FLAG_DISABLE_Z = 2 enum ParticleFlags -
const PARTICLE_FLAG_MAX = 3 enum ParticleFlags -
const EMISSION_SHAPE_POINT = 0 enum EmissionShape -
const EMISSION_SHAPE_SPHERE = 1 enum EmissionShape -
const EMISSION_SHAPE_SPHERE_SURFACE = 2 enum EmissionShape -
const EMISSION_SHAPE_RECTANGLE = 3 enum EmissionShape -
const EMISSION_SHAPE_POINTS = 4 enum EmissionShape -
const EMISSION_SHAPE_DIRECTED_POINTS = 5 enum EmissionShape -
const EMISSION_SHAPE_MAX = 6 enum EmissionShape -
enum DrawOrder -
enum Parameter -
enum ParticleFlags -
enum EmissionShape -
signal finished()
CPUParticles2D #
is_instantiable, Node2D, Node, core, not_builtin_classes
A CPU-based 2D particle emitter.
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.
Members #
var amount: int = 8#
Number of particles emitted in one emission cycle.
var angle_curve: Curve#
Each particle's rotation will be animated along this Curve. Should be a unit Curve.
var angle_max: float = 0.0#
Maximum initial rotation applied to each particle, in degrees.
var angle_min: float = 0.0#
Minimum equivalent of angle_max.
var angular_velocity_curve: Curve#
Each particle's angular velocity will vary along this Curve. Should be a unit Curve.
var angular_velocity_max: float = 0.0#
Maximum initial angular velocity (rotation speed) applied to each particle in degrees per second.
var angular_velocity_min: float = 0.0#
Minimum equivalent of angular_velocity_max.
var anim_offset_curve: Curve#
Each particle's animation offset will vary along this Curve. Should be a unit Curve.
var anim_offset_max: float = 0.0#
Maximum animation offset that corresponds to frame index in the texture. 0 is the first frame, 1 is the last one. See CanvasItemMaterial.particles_animation.
var anim_offset_min: float = 0.0#
Minimum equivalent of anim_offset_max.
var anim_speed_curve: Curve#
Each particle's animation speed will vary along this Curve. Should be a unit Curve.
var anim_speed_max: float = 0.0#
Maximum particle animation speed. Animation speed of 1 means that the particles will make full 0 to 1 offset cycle during lifetime, 2 means 2 cycles etc.
With animation speed greater than 1, remember to enable CanvasItemMaterial.particles_anim_loop property if you want the animation to repeat.
var anim_speed_min: float = 0.0#
Minimum equivalent of anim_speed_max.
var color: Color = Color(1, 1, 1, 1)#
Each particle's initial color. If texture is defined, it will be multiplied by this color.
var color_initial_ramp: Gradient#
Each particle's initial color will vary along this Gradient (multiplied with color).
var color_ramp: Gradient#
Each particle's color will vary along this Gradient over its lifetime (multiplied with color).
var damping_curve: Curve#
Damping will vary along this Curve. Should be a unit Curve.
var damping_max: float = 0.0#
The maximum rate at which particles lose velocity. For example value of 100 means that the particle will go from 100 velocity to 0 in 1 second.
var damping_min: float = 0.0#
Minimum equivalent of damping_max.
var direction: Vector2 = Vector2(1, 0)#
Unit vector specifying the particles' emission direction.
var draw_order = DRAW_ORDER_INDEX#
Particle draw order. Uses DrawOrder values.
var emission_colors: PackedColorArray#
Sets the Colors to modulate particles by when using EMISSION_SHAPE_POINTS or EMISSION_SHAPE_DIRECTED_POINTS.
var emission_normals: PackedVector2Array#
Sets the direction the particles will be emitted in when using EMISSION_SHAPE_DIRECTED_POINTS.
var emission_points: PackedVector2Array#
Sets the initial positions to spawn particles when using EMISSION_SHAPE_POINTS or EMISSION_SHAPE_DIRECTED_POINTS.
var emission_rect_extents: Vector2#
The rectangle's extents if emission_shape is set to EMISSION_SHAPE_RECTANGLE.
var emission_shape = EMISSION_SHAPE_POINT#
Particles will be emitted inside this region. See EmissionShape for possible values.
var emission_sphere_radius: float#
The sphere's radius if emission_shape is set to EMISSION_SHAPE_SPHERE.
var emitting: bool = true#
If true, particles are being emitted. emitting can be used to start and stop particles from emitting. However, if one_shot is true setting emitting to true will not restart the emission cycle until after all active particles finish processing. You can use the finished signal to be notified once all active particles finish processing.
var explosiveness: float = 0.0#
How rapidly particles in an emission cycle are emitted. If greater than 0, there will be a gap in emissions before the next cycle begins.
var fixed_fps: int = 0#
The particle system's frame rate is fixed to a value. For example, 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.
var fract_delta: bool = true#
If true, results in fractional delta calculation which has a smoother particles display effect.
var gravity: Vector2 = Vector2(0, 980)#
Gravity applied to every particle.
var hue_variation_curve: Curve#
Each particle's hue will vary along this Curve. Should be a unit Curve.
var hue_variation_max: float = 0.0#
Maximum initial hue variation applied to each particle. It will shift the particle color's hue.
var hue_variation_min: float = 0.0#
Minimum equivalent of hue_variation_max.
var initial_velocity_max: float = 0.0#
Maximum initial velocity magnitude for each particle. Direction comes from direction and spread.
var initial_velocity_min: float = 0.0#
Minimum equivalent of initial_velocity_max.
var lifetime: float = 1.0#
Amount of time each particle will exist.
var lifetime_randomness: float = 0.0#
Particle lifetime randomness ratio.
var linear_accel_curve: Curve#
Each particle's linear acceleration will vary along this Curve. Should be a unit Curve.
var linear_accel_max: float = 0.0#
Maximum linear acceleration applied to each particle in the direction of motion.
var linear_accel_min: float = 0.0#
Minimum equivalent of linear_accel_max.
var local_coords: bool = false#
If true, 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 false, particles use global coordinates; they will not move or rotate along the CPUParticles2D node (and its parents) when it is moved or rotated.
var one_shot: bool = false#
If true, only one emission cycle occurs. If set true during a cycle, emission will stop at the cycle's end.
var orbit_velocity_curve: Curve#
Each particle's orbital velocity will vary along this Curve. Should be a unit Curve.
var orbit_velocity_max: float = 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.
var orbit_velocity_min: float = 0.0#
Minimum equivalent of orbit_velocity_max.
var particle_flag_align_y: bool = false#
Align Y axis of particle with the direction of its velocity.
var physics_interpolation_mode = PHYSICS_INTERPOLATION_MODE_OFF#
var preprocess: float = 0.0#
Particle system starts as if it had already run for this many seconds.
var radial_accel_curve: Curve#
Each particle's radial acceleration will vary along this Curve. Should be a unit Curve.
var radial_accel_max: float = 0.0#
Maximum radial acceleration applied to each particle. Makes particle accelerate away from the origin or towards it if negative.
var radial_accel_min: float = 0.0#
Minimum equivalent of radial_accel_max.
var randomness: float = 0.0#
Emission lifetime randomness ratio.
var scale_amount_curve: Curve#
Each particle's scale will vary along this Curve. Should be a unit Curve.
var scale_amount_max: float = 1.0#
Maximum initial scale applied to each particle.
var scale_amount_min: float = 1.0#
Minimum equivalent of scale_amount_max.
var scale_curve_x: Curve#
Each particle's horizontal scale will vary along this Curve. Should be a unit Curve.
split_scale must be enabled.
var scale_curve_y: Curve#
Each particle's vertical scale will vary along this Curve. Should be a unit Curve.
split_scale must be enabled.
var seed: int = 0#
Sets the random seed used by the particle system. Only effective if use_fixed_seed is true.
var speed_scale: float = 1.0#
Particle system's running speed scaling ratio. A value of 0 can be used to pause the particles.
var split_scale: bool = false#
If true, the scale curve will be split into x and y components. See scale_curve_x and scale_curve_y.
var spread: float = 45.0#
Each particle's initial direction range from +spread to -spread degrees.
var tangential_accel_curve: Curve#
Each particle's tangential acceleration will vary along this Curve. Should be a unit Curve.
var tangential_accel_max: float = 0.0#
Maximum tangential acceleration applied to each particle. Tangential acceleration is perpendicular to the particle's velocity giving the particles a swirling motion.
var tangential_accel_min: float = 0.0#
Minimum equivalent of tangential_accel_max.
var texture: Texture2D#
Particle texture. If null, particles will be squares.
var use_fixed_seed: bool = false#
If true, particles will use the same seed for every simulation using the seed defined in seed. This is useful for situations where the visual outcome should be consistent across replays, for example when using Movie Maker mode.
Methods #
func convert_from_particles(particles: Node) -> void#
Sets this node's properties to match a given GPUParticles2D node with an assigned ParticleProcessMaterial.
const func get_param_curve(param: int enumCPUParticles2D.Parameter) -> Curve#
const func get_param_max(param: int enumCPUParticles2D.Parameter) -> float#
Returns the maximum value range for the given parameter.
const func get_param_min(param: int enumCPUParticles2D.Parameter) -> float#
Returns the minimum value range for the given parameter.
const func get_particle_flag(particle_flag: int enumCPUParticles2D.ParticleFlags) -> bool#
Returns the enabled state of the given particle flag (see ParticleFlags for options).
func request_particles_process(process_time: float) -> void#
Requests the particles to process for extra process time during a single frame.
Useful for particle playback, if used in combination with use_fixed_seed or by calling restart with parameter keep_seed set to true.
func restart(keep_seed: bool = false) -> void#
Restarts the particle emitter.
If keep_seed is true, the current random seed will be preserved. Useful for seeking and playback.
func set_param_curve(curve: Curve) -> void#
Sets the Curve of the parameter specified by Parameter. Should be a unit Curve.
func set_param_max(value: float) -> void#
Sets the maximum value for the given parameter.
func set_param_min(value: float) -> void#
Sets the minimum value for the given parameter.
func set_particle_flag(enable: bool) -> void#
Enables or disables the given flag (see ParticleFlags for options).
Annotations #
Constants #
const DRAW_ORDER_INDEX = 0 enum DrawOrder#
Particles are drawn in the order emitted.
const DRAW_ORDER_LIFETIME = 1 enum DrawOrder#
Particles are drawn in order of remaining lifetime. In other words, the particle with the highest lifetime is drawn at the front.
const PARAM_INITIAL_LINEAR_VELOCITY = 0 enum Parameter#
Use with set_param_min, set_param_max, and set_param_curve to set initial velocity properties.
const PARAM_ANGULAR_VELOCITY = 1 enum Parameter#
Use with set_param_min, set_param_max, and set_param_curve to set angular velocity properties.
const PARAM_ORBIT_VELOCITY = 2 enum Parameter#
Use with set_param_min, set_param_max, and set_param_curve to set orbital velocity properties.
const PARAM_LINEAR_ACCEL = 3 enum Parameter#
Use with set_param_min, set_param_max, and set_param_curve to set linear acceleration properties.
const PARAM_RADIAL_ACCEL = 4 enum Parameter#
Use with set_param_min, set_param_max, and set_param_curve to set radial acceleration properties.
const PARAM_TANGENTIAL_ACCEL = 5 enum Parameter#
Use with set_param_min, set_param_max, and set_param_curve to set tangential acceleration properties.
const PARAM_DAMPING = 6 enum Parameter#
Use with set_param_min, set_param_max, and set_param_curve to set damping properties.
const PARAM_ANGLE = 7 enum Parameter#
Use with set_param_min, set_param_max, and set_param_curve to set angle properties.
const PARAM_SCALE = 8 enum Parameter#
Use with set_param_min, set_param_max, and set_param_curve to set scale properties.
const PARAM_HUE_VARIATION = 9 enum Parameter#
Use with set_param_min, set_param_max, and set_param_curve to set hue variation properties.
const PARAM_ANIM_SPEED = 10 enum Parameter#
Use with set_param_min, set_param_max, and set_param_curve to set animation speed properties.
const PARAM_ANIM_OFFSET = 11 enum Parameter#
Use with set_param_min, set_param_max, and set_param_curve to set animation offset properties.
const PARAM_MAX = 12 enum Parameter#
Represents the size of the Parameter enum.
const PARTICLE_FLAG_ALIGN_Y_TO_VELOCITY = 0 enum ParticleFlags#
Use with set_particle_flag to set particle_flag_align_y.
const PARTICLE_FLAG_ROTATE_Y = 1 enum ParticleFlags#
Present for consistency with 3D particle nodes, not used in 2D.
const PARTICLE_FLAG_DISABLE_Z = 2 enum ParticleFlags#
Present for consistency with 3D particle nodes, not used in 2D.
const PARTICLE_FLAG_MAX = 3 enum ParticleFlags#
Represents the size of the ParticleFlags enum.
const EMISSION_SHAPE_POINT = 0 enum EmissionShape#
All particles will be emitted from a single point.
const EMISSION_SHAPE_SPHERE = 1 enum EmissionShape#
Particles will be emitted in the volume of a sphere flattened to two dimensions.
const EMISSION_SHAPE_SPHERE_SURFACE = 2 enum EmissionShape#
Particles will be emitted on the surface of a sphere flattened to two dimensions.
const EMISSION_SHAPE_RECTANGLE = 3 enum EmissionShape#
Particles will be emitted in the area of a rectangle.
const EMISSION_SHAPE_POINTS = 4 enum EmissionShape#
Particles will be emitted at a position chosen randomly among emission_points. Particle color will be modulated by emission_colors.
const EMISSION_SHAPE_DIRECTED_POINTS = 5 enum EmissionShape#
Particles will be emitted at a position chosen randomly among emission_points. Particle velocity and rotation will be set based on emission_normals. Particle color will be modulated by emission_colors.
const EMISSION_SHAPE_MAX = 6 enum EmissionShape#
Represents the size of the EmissionShape enum.
Constructors #
Enums #
DrawOrder#
enum DrawOrder {
DRAW_ORDER_INDEX = 0,
DRAW_ORDER_LIFETIME = 1,
}Parameter#
enum Parameter {
PARAM_INITIAL_LINEAR_VELOCITY = 0,
PARAM_ANGULAR_VELOCITY = 1,
PARAM_ORBIT_VELOCITY = 2,
PARAM_LINEAR_ACCEL = 3,
PARAM_RADIAL_ACCEL = 4,
PARAM_TANGENTIAL_ACCEL = 5,
PARAM_DAMPING = 6,
PARAM_ANGLE = 7,
PARAM_SCALE = 8,
PARAM_HUE_VARIATION = 9,
PARAM_ANIM_SPEED = 10,
PARAM_ANIM_OFFSET = 11,
PARAM_MAX = 12,
}ParticleFlags#
enum ParticleFlags {
PARTICLE_FLAG_ALIGN_Y_TO_VELOCITY = 0,
PARTICLE_FLAG_ROTATE_Y = 1,
PARTICLE_FLAG_DISABLE_Z = 2,
PARTICLE_FLAG_MAX = 3,
}EmissionShape#
enum EmissionShape {
EMISSION_SHAPE_POINT = 0,
EMISSION_SHAPE_SPHERE = 1,
EMISSION_SHAPE_SPHERE_SURFACE = 2,
EMISSION_SHAPE_RECTANGLE = 3,
EMISSION_SHAPE_POINTS = 4,
EMISSION_SHAPE_DIRECTED_POINTS = 5,
EMISSION_SHAPE_MAX = 6,
} Operators #
Signals #
signal finished()#
Emitted when all active particles have finished processing. When one_shot is disabled, particles will process continuously, so this is never emitted.