Pulsating circles
in
Programming Questions
•
1 years ago
Ok so I am a complete noob at this but I would like to create pulsating circles that can randomly appear in different sizes, colours and speeds, and ultimately in the end appear and pulse to music, but thats way off in the future.
I assume I have to put the circles in an array and I have already used some random functions for colour and co-ordinates when mouse pressed, but I am completely lost now it come to adding circles.
I have this so far,
<Code>
int r = 255;
int g = 255;
int b = 255;
int a = 75;
// Global variables
float radius = 150.0;
int X, Y;
int nX, nY;
int delay = 1;
// Setup the Processing Canvas
void setup(){
size(1263, 673);
noStroke();
frameRate( 100 );
X = (int) random(width/1);
Y = (int) random(width/3);
nX = X;
nY = Y;
}
// Main draw loop
void draw(){
radius = radius - sin( frameCount / 60 );
// Track circle to new destination
X+=(nX-X)/delay;
Y+=(nY-Y)/delay;
// Fill canvas white
background(255);
// Set fill-color to blue
//noFill();
fill(r,g,b,a);
// Set stroke-color white
//stroke(211, 50, 74);
//strokeWeight(3);
noStroke();
// Draw circle
ellipse( X, Y, radius, radius );
}
// Set circle's next destination
void mousePressed(){
nX = (int) random(width);
nY = (int) random(height);
r = (int) random (255);
g = (int) random (255);
b = (int) random (255);
//a = (int) random (255);
}
Any help would be awesome.
1