class Orbs { float x,y,w,h,s; color c; float angle; // where it begins rotating float angleInc; // variable which determines how fast the orbs rotate around the mouse //creating a constructor to give the orbs variables for x,y,width,height,speed and color Orbs(float tempX, float tempY, float tempW, float tempH, float tempS, color tempC) { x = tempX; y = tempY; w = tempW; h = tempH; s = tempS; c = tempC; angle = random(TWO_PI); // choose a random angle position angleInc = random(PI/255,PI/64); // choose a random angle increment between these two values } void display() { fill(255); smooth(); stroke(c); strokeWeight(1); ellipseMode(CENTER); ellipse(x, y, w, h); //ellipse variable float r = 5; // radius, distance from the mouse that the orbs rotate from float circleX = cos(angle)*r; // use cos to determine x position from the center float circleY = sin(angle)*r; // use sine to determine y position from the center angle = angle + angleInc; // speed at which the orbs rotate if(this.x > mouseX) //how it follows the mouse { this.x = this.x - s; } if(this.x < mouseX) { this.x = this.x + s; } if(this.y > mouseY) { this.y = this.y - s; } if(this.y < mouseY) { this.y = this.y + s; } this.x+=circleX; this.y+=circleY; } }