UIParticle - A UI Particle Emitter

Forked from rParticle: The Light Weight, Open Source, GUI Particle System

UIParticle aims to replicate the built-in ParticleEmitter as closely as possible but in 2D GUIs. I found that rParticle gave the average user a bit too much freedom and some people may want something more familiar, so I created this

It has nearly every property that the 3D particle emitters have

Source code here

Feedback appreciated, please fix my bugs so it isnt as bad for others who want to use it

106 Likes

ive been updating this all night and i feel that it now perfectly mimics the 3d particle system, ive added support for color sequences, size sequences, transparency sequences, a range for speed, the ability to emit filling an entire frame vs a point, full typechecking, and changed much of how it works.

18 Likes

can you also make it like tween size? at the end?

size is a numbersequence so yes

This is really neat. I have been looking for something similar for this for a while, good work truly.

1 Like

Very nice module, I will probably use this in a game! :+1:

1 Like

natural disaster has something similar if I’m not mistaken on purpose it’s very interesting !!

This is really cool stuff! Maybe consider making a pull request onto the main repository.

Hey, just a small thing but in your constructors, you actually make a new table for the object’s metatable per-object which is probably not what you want with respect to memory. Instead you should define your metamethods inside of the class functions table like so:

local ParticleClass: Particle = {}
ParticleClass.__index = ParticleClass

--...
-- when creating the object
return setmetatable(self, ParticleClass)

I also made a pull request to add a version that supports method chaining if you’d like.

Edit: seems to be an issue with the original module so I made an issue ticket thing on the original module.

yeah i noticed that as i usually do it this way, but honestly it was like 3 am and i was too tired to question it. ill go ahead and edit it right now, thanks for pointing it out

1 Like

I love this system, also can you see if you can make one but for trails? it would be for a 2D platformer

1 Like

I keep getting “Keypoints is not a valid member of Color3” error and im not sure why. I used a frame as the hook and a textlabel as the element and just ran the demo in the source code
particletest.rbxl (47.2 KB)

i attached the files and I also tried both your and 7z99’s solution as well, same problem

1 Like

the color property is a colorsequence, not a color3. i can update it to fix this issue

edit: just updated the module on github, lemme know if it fixes it

1 Like

yeah! It works perfectly! My last question is just on changing the position for the particle. Is it always gonna be stuck to the hook? Cause changing the position doesnt seem to change it on the screen, just curious tho! It looks beautiful so thanks for making it!

it should follow the hook, if it doesnt let me know and ill take a look. by follow the hook i mean, if you tween the hook to point b then the particles should follow it there (not already emitted ones, there is no LockedToPart analog as of now)

1 Like

yeah it does! Turns out i had it following the wrong hook lmao, thanks a ton!

1 Like

Overall your module is very helpful and useful but I think I have some feedback I think would be helpful.

Using next as a variable name in your evalNS and evalCS functions causes errors in the calculation of the value

Implementing the drag property from 3d particle emitters would also be pretty simple and convenient.

Idk, if i am making something wrong, but when i emit the particle, the size of it is 0 any solutions ?

can i see your code where you create the emitter?

So, i found that the particle emitter only work with frames, i was trying to use with a image label and the canvas size aways as 0.

By the way the code was very simple.

        local particle   = PARTICLE.new(STAR.Star,STAR.StarParts)
        particle.RotSpeed = NumberRange.new(95,300)
        particle.SpreadAngle = NumberRange.new(0,360)
        particle.Acceleration = Vector2.new(0,-0)
        particle.Color        = ColorSequence.new({ColorSequenceKeypoint.new(0,Color3.fromRGB(255, 255, 255)),ColorSequenceKeypoint.new(1,Color3.new(1, 0.768627, 0))})
        particle.Lifetime     = NumberRange.new(0.6,1.5)
        particle.Transparency         = NumberSequence.new({NumberSequenceKeypoint.new(0,0),NumberSequenceKeypoint.new(0.8,0),NumberSequenceKeypoint.new(1,0.99)})
        particle:Emit(15)

Another bug I found was that when I use transparency, just before the transparency is 1 it blinks at 0 for some reason

But great module. was easy to use ( documentation will make things easier ).