My Projects
👾 Proton.lua
API

Particle

A particle is a prefab to be used by an emitter.

Create New Particle

local Particle = Proton.Particle
 
Particle (Instance: string) {
    ... any?
}

Emitter

Create Emitter

local Emitter = Proton.Emitter
 
Emitter (Particle: UIBase) {
    ... Partial<EmitterConfig>
}

Example:

local Rotation = 0
 
local MyEmitter = Emitter (Particle: UIBase) {
 
    -- Standard Items
    Transparency = NumberSequence.new(0, 1),
    Size = NumberSequence.new(10, 20),
 
    -- We can pass functions that get called on emitter step.
    Rotation = function()
        Rotation + 10
        return Rotation
    end,
 
}

Methods

Emitter API

ℹ️

All emitter methods besides Destroy() return self, allowing chaining of methods if you desire.

MyEmitter:MoveTo(Pos)
         :MountTo(Frame)
         :Play()
         :Destroy()

:Play()

Resumes Emission.

Emitter:Play() :: Emitter

:Stop()

Pauses emission.

Emitter:Stop() :: Emitter

:MoveTo()

Move the emitter to a new (X, Y) position on screen.

Emitter:MoveTo(Vector: Vector2) :: Emitter

:MountTo()

Mount the emitter on a frame for easy animation.

ℹ️

Mounting the emitter to an item will negate all :MoveTo() calls.

Emitter:MountTo(UIElement: Instance, AnchorPoint: Vector2) :: Emitter

:Destroy()

Destroy the emitter, removing any connections and particles connected to this emitter.

Emitter:Destroy() :: void

Emitter Config

Defaults

{
	ViewportCollision = false,
	Transparency = NumberSequence.new(0),
	MaxParticles = 100,
	EmissionRate = 0,
	GravityScale = 1,
	SprayAngle = 45,
	Lifetime = NumberRange.new(1, 3),
	Rotation = 0,
	Gravity = true,
	Force = 300,
	Color = ColorSequence.new(Color3.new(1, 1, 1)),
	Size = NumberSequence.new(5),
	Drag = 0,
} :: EmitterConfig

Types

type EmitterConfig = {
    ViewportCollision: boolean? | () -> boolean?,
    Transparency: NumberSequence? | number? | () -> number?,
    EmissionRate: number? | () -> number?,
    MaxParticles: number?  | () -> number?,
    GravityScale: number? | () -> number?,
    SprayAngle: number? | () -> number?,
    Lifetime: NumberRange? | number | () -> number?,
    Rotation: number? | () -> number?,
    Gravity: boolean? | () -> boolean?,
    Color: ColorSequence? | Color3? | () -> Color3?,
    Force: number? | () -> number?,
    Size: NumberSequence? | number? | () -> number?,
    Drag: number? | () -> number?,
}