Creating a basic trail whilst moving 2d object

Hello, thanks in advance. I’m really stuck on a solution. I need to insure the circle I ahve created leaves a fading trail. All of the solution I have seen seem more advance that the solution I should be aiming for which is a combination of turning off ofSetBackGroundAuto and somehow overlaying the canvas to insure the circle fades whilst it moves across the canvas using the mouse coords.

void ofApp::setup(){

ofSetBackgroundAuto(false);  

ofBackground(0);

}

void ofApp::draw(){

ofSetColor(255);	

ofDrawCircle(mouseX, mouseY, 70);
 
ofSetColor(255, 0, 0);
ofDrawCircle(mouseX, mouseY, 50);
ofBackground(255, 200);

}

Any solutions appreciated.

Check out the openFrameworks example in gl/fboTrailsExample.

The only way I know of creating trails in OF is with FBOs, which is different from Processing and p5.js so a bit confusing at first if you are coming from those or similar languages.

There’s another (more CPU intensive) method too. Storing the last n number of locations of the mouse in a vector and drawing them with decreasing opacity. And then updating the vector when the mouse is moving.

But the FBO method is much better.

Thank you both for the suggestions. Further down the line I will start using FBO’s