Processing: efficiently drawing a gradient [closed]
I'm new to Processing and I've been working on simulating electron motion. Everything seems fine until I'm try to add a gradient color to each particle.The frame rate drops considerably. Here is what I've tried so far: float a=0; float s; void setup() { size(500,500); smooth(); frameRate(500); colorMode(HSB,360,100,100); noStroke(); ellipseMode(RADIUS); } void draw() { background(200,0,100); pushMatrix(); translate(width/2, height/2); rotate(radians(-18)); for ( int r = width ; r >= 0; r = r - 1 ) { s = 500*exp(-r); fill(202, s, 100); ellipse(100*cos(a), 50*sin(a), r, r); } a+=0.1; popMatrix()