//Config float initialRadius = 5; float radiusDelta = 3; float fadeDelta = -0.5; int delay = 30; // Declare and initialize delay in frames int bufferSize = 20; // Declare and initialize ring buffer size int sourceX = mouseX; // Declare and initialize source point x coordinate to current mouse x coordinate int sourceY = mouseY; // Declare and initialize source point y coordinate to current mouse y coordinate float[] radiusBuffer = new float[bufferSize]; // Declare and initialize radius buffer int[] sourceXBuffer = new int[bufferSize]; // Declare and initialize source point x coordinate buffer int[] sourceYBuffer = new int[bufferSize]; // Declare and initialize source point y coordinate buffer int[] colors = new int[bufferSize]; // Declare and initialize color buffer float[] fades = new float[bufferSize]; // Declare and initialize fade buffer int bufferIndex = 0; // Declare and initialize buffer index int frameCount = 0; // Declare and initialize frame counter void setup() { size(1600, 1200); // Set canvas size colorMode(HSB, 360, 100, 100); // Set color mode to HSB } void draw() { background(255); // Clear canvas for (int i = 0; i < bufferSize; i++) { // Iterate over ring buffer float r = radiusBuffer[i]; // Get radius value from buffer int x = sourceXBuffer[i]; // Get source point x coordinate from buffer int y = sourceYBuffer[i]; // Get source point y coordinate from buffer stroke(colors[i], fades[i]); // Set stroke color from color buffer noFill(); // Remove fill ellipse(x, y, r, r); // Draw circle with radius and source point coordinates from buffers radiusBuffer[i]+=radiusDelta; fades[i] = max(0, fades[i] + fadeDelta); // Decrease fade value by 5 } if(mousePressed){ if (frameCount % delay == 0) { // Check if delay has passed SpawnNewWave(); } } sourceX = mouseX; sourceY = mouseY; //radius += 2; // Increment radius frameCount++; // Increment frame counter } void SpawnNewWave(){ radiusBuffer[bufferIndex] = initialRadius; // Add current radius to buffer sourceXBuffer[bufferIndex] = sourceX; // Add current source point x coordinate to buffer sourceYBuffer[bufferIndex] = sourceY; // Add current source point y coordinate to buffer colors[bufferIndex] = color(0); // Add random color to color buffer fades[bufferIndex] = 255; // Add full fade value to fade buffer bufferIndex = (bufferIndex + 1) % bufferSize; // Increment buffer index and wrap around if necessary //radius = 5; // Reset radius to small value } void ClearWave(){ // Clear source point buffers for (int i = 0; i < bufferSize; i++) { sourceXBuffer[i] = 0; sourceYBuffer[i] = 0; } } void mousePressed() { }