Love2D APIParticleSystemOn this pageParticleSystem Description: A ParticleSystem can be used to create particle effects like fire or smoke. type Type: Function. Description: Gets the type of the object as a string. Signature: type: function(self: ParticleSystem): string Returns: Return TypeDescriptionstringThe type as a string. Of Type: Function. Description: Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true. Signature: typeOf: function(self: ParticleSystem, type_name: string): boolean Parameters: ParameterTypeDescriptiontype_namestringThe name of the type to check for. Returns: Return TypeDescriptionbooleanTrue if the object is of the specified type, false otherwise. release Type: Function. Description: Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread. This method can be used to immediately clean up resources without waiting for Lua's garbage collector. Signature: release: function(self: ParticleSystem): boolean Returns: Return TypeDescriptionbooleanTrue if the object was released by this call, false if it had been previously released. clone Type: Function. Description: Creates an identical copy of the ParticleSystem in the stopped state. Overload details: Cloned ParticleSystem inherit all the set-able state of the original ParticleSystem, but they are initialized stopped. Signature: clone: function(self: ParticleSystem): ParticleSystem Returns: Return TypeDescriptionParticleSystemThe new identical copy of this ParticleSystem. setTexture Type: Function. Description: Sets the texture (Image or Canvas) to be used for the particles. Signature: setTexture: function(self: ParticleSystem, texture: Image | Canvas) Parameters: ParameterTypeDescriptiontextureImage or CanvasAn Image or Canvas to use for the particles. getTexture Type: Function. Description: Gets the texture (Image or Canvas) used for the particles. Signature: getTexture: function(self: ParticleSystem): Image | Canvas Returns: Return TypeDescriptionImage or CanvasThe Image or Canvas used for the particles. setBufferSize Type: Function. Description: Sets the size of the buffer (the max allowed amount of particles in the system). Signature: setBufferSize: function(self: ParticleSystem, size: integer) Parameters: ParameterTypeDescriptionsizeintegerThe buffer size. getBufferSize Type: Function. Description: Gets the maximum number of particles the ParticleSystem can have at once. Signature: getBufferSize: function(self: ParticleSystem): integer Returns: Return TypeDescriptionintegerThe maximum number of particles. setInsertMode Type: Function. Description: Sets the mode to use when the ParticleSystem adds new particles. Signature: setInsertMode: function(self: ParticleSystem, mode: string) Parameters: ParameterTypeDescriptionmodestringThe mode to use when the ParticleSystem adds new particles. getInsertMode Type: Function. Description: Gets the mode used when the ParticleSystem adds new particles. Signature: getInsertMode: function(self: ParticleSystem): string Returns: Return TypeDescriptionstringThe mode used when the ParticleSystem adds new particles. setEmissionRate Type: Function. Description: Sets the amount of particles emitted per second. Signature: setEmissionRate: function(self: ParticleSystem, rate: number) Parameters: ParameterTypeDescriptionratenumberThe amount of particles per second. getEmissionRate Type: Function. Description: Gets the amount of particles emitted per second. Signature: getEmissionRate: function(self: ParticleSystem): number Returns: Return TypeDescriptionnumberThe amount of particles per second. setEmitterLifetime Type: Function. Description: Sets how long the particle system should emit particles (if -1 then it emits particles forever). Signature: setEmitterLifetime: function(self: ParticleSystem, lifetime: number) Parameters: ParameterTypeDescriptionlifetimenumberThe lifetime of the emitter (in seconds). getEmitterLifetime Type: Function. Description: Gets how long the particle system will emit particles (if -1 then it emits particles forever). Signature: getEmitterLifetime: function(self: ParticleSystem): number Returns: Return TypeDescriptionnumberThe lifetime of the emitter (in seconds). setParticleLifetime Type: Function. Description: Sets the lifetime of the particles. Signature: setParticleLifetime: function(self: ParticleSystem, minimum: number, maximum?: number) Parameters: ParameterTypeDescriptionminimumnumberThe minimum life of the particles (in seconds).maximumnumberThe maximum life of the particles (in seconds). (Default: min.) getParticleLifetime Type: Function. Description: Gets the lifetime of the particles. Signature: getParticleLifetime: function(self: ParticleSystem): number, number Returns: Return TypeDescriptionnumberThe minimum life of the particles (in seconds).numberThe maximum life of the particles (in seconds). setPosition Type: Function. Description: Sets the position of the emitter. Signature: setPosition: function(self: ParticleSystem, x: number, y: number) Parameters: ParameterTypeDescriptionxnumberPosition along x-axis.ynumberPosition along y-axis. getPosition Type: Function. Description: Gets the position of the emitter. Signature: getPosition: function(self: ParticleSystem): number, number Returns: Return TypeDescriptionnumberPosition along x-axis.numberPosition along y-axis. moveTo Type: Function. Description: Moves the position of the emitter. This results in smoother particle spawning behaviour than if ParticleSystem:setPosition is used every frame. Signature: moveTo: function(self: ParticleSystem, x: number, y: number) Parameters: ParameterTypeDescriptionxnumberPosition along x-axis.ynumberPosition along y-axis. setEmissionArea Type: Function. Description: Sets area-based spawn parameters for the particles. Newly created particles will spawn in an area around the emitter based on the parameters to this function. Signature: setEmissionArea: function(self: ParticleSystem, distribution?: string, x?: number, y?: number, angle?: number, relative?: boolean) Parameters: ParameterTypeDescriptiondistributionstringThe type of distribution for new particles.xnumberThe maximum spawn distance from the emitter along the x-axis for uniform distribution, or the standard deviation along the x-axis for normal distribution.ynumberThe maximum spawn distance from the emitter along the y-axis for uniform distribution, or the standard deviation along the y-axis for normal distribution.anglenumberThe angle in radians of the emission area. (Default: 0.)relativebooleanTrue if newly spawned particles will be oriented relative to the center of the emission area, false otherwise. (Default: false.) getEmissionArea Type: Function. Description: Gets the area-based spawn parameters for the particles. Signature: getEmissionArea: function(self: ParticleSystem): string, number, number, number, boolean setAreaSpread: function(self: ParticleSystem, distribution?: string, x?: number, y?: number) getAreaSpread: function(self: ParticleSystem): string, number, number Parameters: ParameterTypeDescriptiondistributionstringThe distribution parameter.xnumberThe x parameter.ynumberThe y parameter. Returns: Return TypeDescriptionstringThe type of distribution for new particles.numberThe maximum spawn distance from the emitter along the x-axis for uniform distribution, or the standard deviation along the x-axis for normal distribution.numberThe maximum spawn distance from the emitter along the y-axis for uniform distribution, or the standard deviation along the y-axis for normal distribution.numberThe angle in radians of the emission area.booleanTrue if newly spawned particles will be oriented relative to the center of the emission area, false otherwise. setDirection Type: Function. Description: Sets the direction the particles will be emitted in. Signature: setDirection: function(self: ParticleSystem, direction: number) Parameters: ParameterTypeDescriptiondirectionnumberThe direction of the particles (in radians). getDirection Type: Function. Description: Gets the direction of the particle emitter (in radians). Signature: getDirection: function(self: ParticleSystem): number Returns: Return TypeDescriptionnumberThe direction of the emitter (radians). setSpread Type: Function. Description: Sets the amount of spread for the system. Signature: setSpread: function(self: ParticleSystem, spread: number) Parameters: ParameterTypeDescriptionspreadnumberThe amount of spread (radians). getSpread Type: Function. Description: Gets the amount of directional spread of the particle emitter (in radians). Signature: getSpread: function(self: ParticleSystem): number Returns: Return TypeDescriptionnumberThe spread of the emitter (radians). setSpeed Type: Function. Description: Sets the speed of the particles. Signature: setSpeed: function(self: ParticleSystem, minimum: number, maximum?: number) Parameters: ParameterTypeDescriptionminimumnumberThe minimum linear speed of the particles.maximumnumberThe maximum linear speed of the particles. (Default: min.) getSpeed Type: Function. Description: Gets the speed of the particles. Signature: getSpeed: function(self: ParticleSystem): number, number Returns: Return TypeDescriptionnumberThe minimum linear speed of the particles.numberThe maximum linear speed of the particles. setLinearAcceleration Type: Function. Description: Sets the linear acceleration (acceleration along the x and y axes) for particles. Every particle created will accelerate along the x and y axes between xmin,ymin and xmax,ymax. Signature: setLinearAcceleration: function(self: ParticleSystem, xmin: number, ymin: number, xmax?: number, ymax?: number) Parameters: ParameterTypeDescriptionxminnumberThe minimum acceleration along the x axis.yminnumberThe minimum acceleration along the y axis.xmaxnumberThe maximum acceleration along the x axis. (Default: xmin.)ymaxnumberThe maximum acceleration along the y axis. (Default: ymin.) getLinearAcceleration Type: Function. Description: Gets the linear acceleration (acceleration along the x and y axes) for particles. Every particle created will accelerate along the x and y axes between xmin,ymin and xmax,ymax. Signature: getLinearAcceleration: function(self: ParticleSystem): number, number, number, number Returns: Return TypeDescriptionnumberThe minimum acceleration along the x axis.numberThe minimum acceleration along the y axis.numberThe maximum acceleration along the x axis.numberThe maximum acceleration along the y axis. setRadialAcceleration Type: Function. Description: Set the radial acceleration (away from the emitter). Signature: setRadialAcceleration: function(self: ParticleSystem, minimum: number, maximum?: number) Parameters: ParameterTypeDescriptionminimumnumberThe minimum acceleration.maximumnumberThe maximum acceleration. (Default: min.) getRadialAcceleration Type: Function. Description: Gets the radial acceleration (away from the emitter). Signature: getRadialAcceleration: function(self: ParticleSystem): number, number Returns: Return TypeDescriptionnumberThe minimum acceleration.numberThe maximum acceleration. setTangentialAcceleration Type: Function. Description: Sets the tangential acceleration (acceleration perpendicular to the particle's direction). Signature: setTangentialAcceleration: function(self: ParticleSystem, minimum: number, maximum?: number) Parameters: ParameterTypeDescriptionminimumnumberThe minimum acceleration.maximumnumberThe maximum acceleration. (Default: min.) getTangentialAcceleration Type: Function. Description: Gets the tangential acceleration (acceleration perpendicular to the particle's direction). Signature: getTangentialAcceleration: function(self: ParticleSystem): number, number Returns: Return TypeDescriptionnumberThe minimum acceleration.numberThe maximum acceleration. setLinearDamping Type: Function. Description: Sets the amount of linear damping (constant deceleration) for particles. Signature: setLinearDamping: function(self: ParticleSystem, minimum: number, maximum?: number) Parameters: ParameterTypeDescriptionminimumnumberThe minimum amount of linear damping applied to particles.maximumnumberThe maximum amount of linear damping applied to particles. (Default: min.) getLinearDamping Type: Function. Description: Gets the amount of linear damping (constant deceleration) for particles. Signature: getLinearDamping: function(self: ParticleSystem): number, number Returns: Return TypeDescriptionnumberThe minimum amount of linear damping applied to particles.numberThe maximum amount of linear damping applied to particles. setSizes Type: Function. Description: Sets a series of sizes by which to scale a particle sprite. 1.0 is normal size. The particle system will interpolate between each size evenly over the particle's lifetime. At least one size must be specified. A maximum of eight may be used. Signature: setSizes: function(self: ParticleSystem, sizes: number...) Parameters: ParameterTypeDescriptionsizesnumber...The first size. getSizes Type: Function. Description: Gets the series of sizes by which the sprite is scaled. 1.0 is normal size. The particle system will interpolate between each size evenly over the particle's lifetime. Signature: getSizes: function(self: ParticleSystem): number... Returns: Return TypeDescriptionnumber...The first size. setSizeVariation Type: Function. Description: Sets the amount of size variation (0 meaning no variation and 1 meaning full variation between start and end). Signature: setSizeVariation: function(self: ParticleSystem, variation: number) Parameters: ParameterTypeDescriptionvariationnumberThe amount of variation (0 meaning no variation and 1 meaning full variation between start and end). getSizeVariation Type: Function. Description: Gets the amount of size variation (0 meaning no variation and 1 meaning full variation between start and end). Signature: getSizeVariation: function(self: ParticleSystem): number Returns: Return TypeDescriptionnumberThe amount of variation (0 meaning no variation and 1 meaning full variation between start and end). setRotation Type: Function. Description: Sets the rotation of the image upon particle creation (in radians). Signature: setRotation: function(self: ParticleSystem, minimum: number, maximum?: number) Parameters: ParameterTypeDescriptionminimumnumberThe minimum initial angle (radians).maximumnumberThe maximum initial angle (radians). (Default: min.) getRotation Type: Function. Description: Gets the rotation of the image upon particle creation (in radians). Signature: getRotation: function(self: ParticleSystem): number, number Returns: Return TypeDescriptionnumberThe minimum initial angle (radians).numberThe maximum initial angle (radians). setSpin Type: Function. Description: Sets the spin of the sprite. Signature: setSpin: function(self: ParticleSystem, start: number, finish?: number) Parameters: ParameterTypeDescriptionstartnumberThe minimum spin (radians per second).finishnumberThe maximum spin (radians per second). (Default: min.) getSpin Type: Function. Description: Gets the spin of the sprite. Signature: getSpin: function(self: ParticleSystem): number, number Returns: Return TypeDescriptionnumberThe minimum spin (radians per second).numberThe maximum spin (radians per second). setSpinVariation Type: Function. Description: Sets the amount of spin variation (0 meaning no variation and 1 meaning full variation between start and end). Signature: setSpinVariation: function(self: ParticleSystem, variation: number) Parameters: ParameterTypeDescriptionvariationnumberThe amount of variation (0 meaning no variation and 1 meaning full variation between start and end). getSpinVariation Type: Function. Description: Gets the amount of spin variation (0 meaning no variation and 1 meaning full variation between start and end). Signature: getSpinVariation: function(self: ParticleSystem): number Returns: Return TypeDescriptionnumberThe amount of variation (0 meaning no variation and 1 meaning full variation between start and end). setOffset Type: Function. Description: Set the offset position which the particle sprite is rotated around. If this function is not used, the particles rotate around their center. Signature: setOffset: function(self: ParticleSystem, x: number, y: number) Parameters: ParameterTypeDescriptionxnumberThe x coordinate of the rotation offset.ynumberThe y coordinate of the rotation offset. getOffset Type: Function. Description: Gets the particle image's draw offset. Signature: getOffset: function(self: ParticleSystem): number, number Returns: Return TypeDescriptionnumberThe x coordinate of the particle image's draw offset.numberThe y coordinate of the particle image's draw offset. setColors Type: Function. Description: Sets a series of colors to apply to the particle sprite. The particle system will interpolate between each color evenly over the particle's lifetime. Arguments can be passed in groups of four, representing the components of the desired RGBA value, or as tables of RGBA component values, with a default alpha value of 1 if only three values are given. At least one color must be specified. A maximum of eight may be used. In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. Signature: setColors: function(self: ParticleSystem, colors: any...) Parameters: ParameterTypeDescriptioncolorsany...First color, a numerical indexed table with the red, green, blue and alpha values as numbers (0-1). The alpha is optional and defaults to 1 if it is left out. getColors Type: Function. Description: Gets the series of colors applied to the particle sprite. In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. Signature: getColors: function(self: ParticleSystem): {number}... Returns: Return TypeDescription{number}...First color, red component (0-1). setQuads Type: Function. Description: Sets a series of Quads to use for the particle sprites. Particles will choose a Quad from the list based on the particle's current lifetime, allowing for the use of animated sprite sheets with ParticleSystems. Signature: setQuads: function(self: ParticleSystem, quads: any...) Parameters: ParameterTypeDescriptionquadsany...A table containing the Quads to use. getQuads Type: Function. Description: Gets the series of Quads used for the particle sprites. Signature: getQuads: function(self: ParticleSystem): {Quad} Returns: Return TypeDescription{Quad}A table containing the Quads used. setRelativeRotation Type: Function. Description: Sets whether particle angles and rotations are relative to their velocities. If enabled, particles are aligned to the angle of their velocities and rotate relative to that angle. Signature: setRelativeRotation: function(self: ParticleSystem, enabled: boolean) Parameters: ParameterTypeDescriptionenabledbooleanTrue to enable relative particle rotation, false to disable it. hasRelativeRotation Type: Function. Description: Gets whether particle angles and rotations are relative to their velocities. If enabled, particles are aligned to the angle of their velocities and rotate relative to that angle. Signature: hasRelativeRotation: function(self: ParticleSystem): boolean Returns: Return TypeDescriptionbooleanTrue if relative particle rotation is enabled, false if it's disabled. getCount Type: Function. Description: Gets the number of particles that are currently in the system. Signature: getCount: function(self: ParticleSystem): integer Returns: Return TypeDescriptionintegerThe current number of live particles. start Type: Function. Description: Starts the particle emitter. Signature: start: function(self: ParticleSystem) stop Type: Function. Description: Stops the particle emitter, resetting the lifetime counter. Signature: stop: function(self: ParticleSystem) pause Type: Function. Description: Pauses the particle emitter. Signature: pause: function(self: ParticleSystem) reset Type: Function. Description: Resets the particle emitter, removing any existing particles and resetting the lifetime counter. Signature: reset: function(self: ParticleSystem) emit Type: Function. Description: Emits a burst of particles from the particle emitter. Signature: emit: function(self: ParticleSystem, count: integer) Parameters: ParameterTypeDescriptioncountintegerThe amount of particles to emit. The number of emitted particles will be truncated if the particle system's max buffer size is reached. isActive Type: Function. Description: Checks whether the particle system is actively emitting particles. Signature: isActive: function(self: ParticleSystem): boolean Returns: Return TypeDescriptionbooleanTrue if system is active, false otherwise. isPaused Type: Function. Description: Checks whether the particle system is paused. Signature: isPaused: function(self: ParticleSystem): boolean Returns: Return TypeDescriptionbooleanTrue if system is paused, false otherwise. isStopped Type: Function. Description: Checks whether the particle system is stopped. Signature: isStopped: function(self: ParticleSystem): boolean isEmpty: function(self: ParticleSystem): boolean isFull: function(self: ParticleSystem): boolean Returns: Return TypeDescriptionbooleanTrue if system is stopped, false otherwise. update Type: Function. Description: Updates the particle system; moving, creating and killing particles. Signature: update: function(self: ParticleSystem, delta_time: number) Parameters: ParameterTypeDescriptiondelta_timenumberThe time (seconds) since last frame.