# Particle system

Just wanted to share some videos of a particle system I created.

Hopefully I’ve linked in the videos properly.

… and the answer is, No. I have not linked in the videos properly.

http://youtu.be/obLn3ZjMLLM

http://youtu.be/nGq0bTRvRis

This one looks so much better on my ipad … oh well.
http://youtu.be/ITD-6Um2XAI

http://youtu.be/4KnksoBA_8U

Hey @Reyals123, It looks really good. Will you show us how to make it?

Beautiful! How do you make this hazy aspect? How many partlcles involved?

It’s amazing! Show us your code, especially Meteor code. Please! [-O<

Looks very nice. I like the colour grading you’ve done on the age of the particles.

Looks like Autodesk Fluid FX for iPad!

Thanks everyone. My code is pretty sloppy. I start off just playing with one sprite and kept adding and adding to it. So I’d have to clean it up quite a bit to make it presentable. Plus being new to codea and lua I made some silly mistakes. For example, one of my functions I wrote is called RotateVec2 only later to discover Vec2:rotate.

@Jmv38 the videos display the number of particles currently in the system. As for the hazy effect, part of that is just the alpha value going to 0 over the course of the particle’s/sprite’s lifetime.

The following function is the key to making it all work.
I use it to scale the sprites as well as change the colors of sprites.

```function lerp(a,b,amount)
return (a + (b-a) * amount)
end

```

I do have a question about that function. What do I need to write to make it so that I can call that function with colors. Currently I'm storing those values in Color1 and Color2 as vec4 variables and do the following.

self.displayColor = color(self.displayColor.x,self.displayColor.y, self.displayColor.z,
self.displayColor.w)

```

Well I just at this moment discovered. color:mix ... ... Nevermind  :">

Like I said ... sloppy code.```

Might also want to look at my Colour library.

I just changed my code to use mix instead of my lerp and the Alpha channel gets interpolated backwards.

Thanks Andrew I will look into it. Although part of the fun for me is making the mistakes haha.

A saw my mistake with the alpha channel color:mix problem. I need to do color2:mix(color1, amount) to get the same results as my lerp function.

Painting with particle system