In this recipe, we will show you how to add a tail to the particle animation.
In this recipe we are going to use the code base from the recipe Applying repulsion and attraction forces from Chapter 5, Building Particle Systems.
We will add a tail to the particles using different techniques.
Simply replace the draw
method with the following code:
void MainApp::draw() { gl::enableAlphaBlending(); gl::setViewport(getWindowBounds()); gl::setMatricesWindow(getWindowWidth(), getWindowHeight()); gl::color( ColorA(0.f,0.f,0.f, 0.05f) ); gl::drawSolidRect(getWindowBounds()); gl::color( ColorA(1.f,1.f,1.f, 1.f) ); mParticleSystem.draw(); }