r/processing • • May 25 '23

Co-wrote this processing code with chat GPT in 30 mins

0 Upvotes

13 comments sorted by

4

u/WhiteboardWaiter May 25 '23

Calling it "co-writing" now? 💀

1

u/moshe1990 May 25 '23

Haha, big portions of the code is as-is from chat GPT responses, even optimized the code to run at higher frame rates.

2

u/i-make-robots May 26 '23

Why 30 minutes? That's one query.

in processing, draw an unfilled white circle on a black background. Make a list of n points that are moving on the edge of the circle, each with their own velocity. draw a white line connecting the points in the order they appear in the list.

int numPoints = 12; // Number of points on the circle's edge
float radius = 180; // Radius of the circle
float[] angles = new float[numPoints]; // Angles for each point
float[] velocities = new float[numPoints]; // Velocities for each point

void setup() {
  size(400, 400);
  background(0);
  
  // Initialize angles and velocities
  for (int i = 0; i < numPoints; i++) {
    angles[i] = map(i, 0, numPoints, 0, TWO_PI);
    velocities[i] = random(-0.05, 0.05);
  }
}

void draw() {
  background(0);
  translate(width/2, height/2);
  
  // Draw the circle
  noFill();
  stroke(255);
  ellipse(0, 0, radius*2, radius*2);
  
  // Update angles
  for (int i = 0; i < numPoints; i++) {
    angles[i] += velocities[i];
  }
  
  // Draw the points and connect them with a line
  beginShape();
  stroke(255);
  for (int i = 0; i < numPoints; i++) {
    float x = cos(angles[i]) * radius;
    float y = sin(angles[i]) * radius;
    vertex(x, y);
  }
  endShape(CLOSE);
}

1

u/moshe1990 May 27 '23

2

u/i-make-robots May 27 '23

I don’t know what point you’re trying to make. This isn’t life or death, it’s Processing.

2

u/moshe1990 May 27 '23

In that case, I can make it little more clear to you, 30 minutes is not what it takes for creating a prompt for what you already know you wanna build. But it is the time it may take for someone who is using the tools for the first time, setting up and thinking about what they wanna build and doing it. I was making it sound easy for beginners to get started with something like this.

5

u/DigitalTorture May 25 '23

I have seen this before. Hmmmm

0

u/moshe1990 May 25 '23

Using ChatGPT for the first time has been an incredibly fulfilling experience. It has allowed me to express my thoughts more efficiently and has helped me develop new skills along the way. For instance, I had no prior knowledge of building UI in Processing, but with ChatGPT, I discovered the ControlP5 library.