ReactEmitter
Types
NormalId2D
type NormalId2D = "Top" | "Right" | "Bottom" | "Left"Used for Emission Direction on the Rectangle shape. Functions like the regular NormalId, but without the Z-axis (Front, Back)
ParticleEmitterShape2D
type ParticleEmitterShape2D = "Rectangle" | "Annulus"Controls the shape of the emitter, where Rectangle is the 2D equivalent of Box and Annulus is the 2D equivalent of Disc.
Annulus also functions like a 2D version of Cylinder or Sphere when ShapePartial is set to 1.
ParticleEmitterShapeStyle2D
type ParticleEmitterShapeStyle2D = "Area" | "Perimeter"Controls where particles will be emitted within the emitter's shape.
Area is the 2D equivalent of Volume, and Perimeter is the 2D equivalent of Surface.
For an Annulus shape, a ShapePartial of 0 is equivalent to the perimeter.
EmitterProps
interface EmitterProps {Brightness: number--
[1] How bright this particle appears. Note that since ImageLabels do not get brighter at RGB values above 255, this has limited use.
Color: ColorSequence--
[255, 255, 255] The Color of each particle over its lifetime. Use ColorSequence.new(Color3.new(r, g, b)) for a solid color.
Drag: number--
[0] Determines the rate in seconds particles lose half their speed through exponential decay. Setting to negative will cause particles' velocity to grow exponentially.
Enabled: boolean--
[true] Will emit particles at Rate * TimeScale per second when enabled. Particles can be manually emitted on a disbled emitter with the imperative API.
FlipbookFramerate: NumberRange--
[1] Determines how fast the flipbook texture animates in frames per second. Applies to FlipbookModes Loop and Random.
FlipbookSizeX: number--
[1] The number of cells in the flipbook texture when using FlipbookMode Custom.
FlipbookSizeY: number--
[1] the number of rows in the flipbook texture when using FlipbookMode Custom.
FlipbookStartRandom: boolean--
[false] Determines whether to start at a random frame chosen per particle instead of starting at frame zero. Can be used with Framerate zero for a random texture.
Lifetime: NumberRange--
[5, 10] Defines a random range of ages for newly emitted particles. Particles will despawn after their age passes their lifetime.
Rate: number--
[20] How many particles to emit per second (at TimeScale 1) when the Emitter is enabled. Goes to 200, but be careful because UI particles are a lot more expensive than ParticleEmitters.
Rotation: NumberRange--
[0] Defines a random range of rotations in degrees for the particle to start at.
RotSpeed: NumberRange--
[0] Determines the range of angular speeds of emitted particles, measured in degrees per second.
Shape: ParticleEmitterShape2D--
[Rectangle] 2D Shape of the emitter, either Rectangle (like Box) or Annulus (like Cylinder, Disc, or Sphere).
ShapeDimensions: Vector2--
[1, 1] Absolute size of the emitter. A React State can be helpful for this.
ShapeInOut: Enum.ParticleEmitterShapeInOut--
[Outward] Selects whether particles emit outward only, inward only, or in both dimensions.
ShapePartial: number--
[1] For Annulus shapes, a multiplier between [0, 1] for the inner radius relative to the outer radius, where 1 is a full circle and 0 is the perimeter.
ShapeStyle: ParticleEmitterShapeStyle2D--
[Area] If particles should spawn in the whole area of the shape or just on the perimeter of the shape.
Size: NumberSequence--
[1] Determines the relative size over individual particles' lifetimes. Use NumberSequence.new(n) for a single size. Size is relative to the ParticleRenderer (relative to the larger of the two dimensions).
Speed: NumberRange--
[5] A range of speeds for the particle to start at. Can be set negative to have the particle go backwards.
SpreadAngle: number--
[0] A number determining the degrees either side of the emission direction to randomly offset the starting direction of particles by.
Squash: NumberSequence--
[0] Allows for non-uniform scaling of particles over their lifetimes. >0 elongates it vertically, and <0 elongates it horizontally.
Texture: Content--
[sparkles] The texture of each particle, given as a Content (e.g. Content.fromAssetId(xxxx) or Content.fromUri("rbxassetid://xxxx")).
TimeScale: number--
[1] Multiplier to how fast particles are simulated. Allows for values outside the range [0, 1]. Applies to rate as well.
Transparency: NumberRange--
[0] Determines the transparency of individual particles over their lifetimes. Use NumberSequence.new(n) for a single transparency.
}These are the props used by useEmitter / useEmitters to create an Emitter. Every field is optional and has a default if not given.
Functions
ParticleRenderer
ReactEmitter.ParticleRenderer(props: {LocalTransparencyModifier: number?,ZOffset: number?,native: {[any]: any}?}) → ReactElementuseEmitter
ReactEmitter.useEmitter() → ({emit: (number) → ()}?--
Imperative API if props was a function
)useEmitters
ReactEmitter.useEmitters(count: number,--
The number of emitters to create
props: {EmitterProps} | (index: number) → EmitterProps--
The properties for each emitter, either as a table or a function that returns a table given the index
) → ({emit: (callback: (index: number) → number) → ()}?--
Imperative API created when passing a function as props
)A hook that creates and manages multiple particle emitters. The props parameter can be either a table of emitter properties or a function that returns emitter properties based on the index.