Please help! Drawing on a background

I have this code (with a given set of data imported from Excel): ////////////////////////////////////////////////////////

 int   nbr_circles = 500; //total number of runs
  float angle_incr = 2*PI / nbr_circles;

  void setup() {
    size(600,600);
    smooth();
    frameRate(20);
  }

  void draw() {
    background(255);

    fill(0);

    float elapsedSeconds = millis()*.001;
    float angle_incr = radians(2 + frameCount/12.0);

    float cx = width/2;
    float cy = height/2;
    float outer_rad = width*.45;

    String[] lines = loadStrings("distances.csv"); //this will become the diameter
    int[] sm_diameter =  int(split(lines[0],","));

    for (int i = 1; i <= nbr_circles; ++i) {
      float ratio = i/(float)nbr_circles;
      float spiral_rad = ratio * outer_rad;
      float angle = i*angle_incr;
      float x = cx + cos(angle) * spiral_rad;
      float y = cy + sin(angle) * spiral_rad;

      // draw tiny circle at x,y
      noFill();
      ellipse(x, y, sm_diameter[i], sm_diameter[i]);
    }
    noLoop();
  }

////////////////////////////////////////////////////////

And I want to draw on it with this code:

////////////////////////////////////////////////////////

void setup() {
size(500, 500);
    background(0);
}
void draw() {
    float r = random(0, 255);
    float g = random(0, 255);
    float b = random(0, 255);
    color lineColor = color(r,g,b);
    stroke(lineColor);
    if(mousePressed){

line(width/2, height/2,
    mouseX, mouseY);
}}

////////////////////////////////////////////////////////

Even if this means taking a screenshot of the first part and adding it in as a background. Please help!

Answers

Sign In or Register to comment.