I made a fire work in 2D (its movement is 2D anyway) with a simple formula using cos and sin.

void move() {
// Spark move
// move
x = centerX+cos(angle)*radius;
y = centerY+sin(angle)*radius;
radius+=radius_Add;
if (radius>maxRadius)
isDead=true;
}// function

My question is, how can I make it so that the movement would be 3D (sparks fly away forming a full sphere)

void move() {
// Spark move
// move
x = centerX+cos(angle)*radius;
y = centerY+sin(angle)*radius;
z = centerZ+????????????(angle)*radius;
radius+=radius_Add;
if (radius>maxRadius)
isDead=true;
}// function

One way is to rotateY before translating x,y – so different circles of sparks will fly in different directions. This won’t look like a sphere, though, more like a beachball.

Another option is to plot the point on a sphere, then scale it as it flies out. Multiple methods of doing that – one by you (!)…

This was just me tinkering with formulas.
There may be something useful in this for you; I know I will play with this some more!
Thanks for inspiring me.