I’m in a class, and the current assignment is to create a complex pattern. I want to make spirals that start in the middle and extend outward, getting smaller as they go out. I’ve looked around the class to no avail. I found something for generating a single spiral using points, but I’m looking for a connected spiral.
I have used Eclipse before to make games, but that was about four years ago. I’m completely new to Processing, and I’m even more lost.
Okay. So you want to make some spirals.
Do you understand how setup() and draw() work?
Can you draw things? Ellipses? Lines? Use colors?
How do you feel about the functions scale(), translate(), and rotate()?
What have you got so far? Can we see your code?
What have you tried? What works? What didn’t?
What did you want? Can you draw a mock-up image of it?
I know how setup() and draw() work, I am able to draw things including ellipses and lines and use colors. I’m decently comfortable with scale(),translate(), and rotate(). I’ll add in my code below. I’ve tried using a for loop and floats with a curveVertex(), and that gets it going.
My code is super messy. I’ll post what I currently have as it is, and then I’ll clean it up and post that.
//float z = 0.01;
//float theta = 0.01;
//int centerX = 250;
//int centerY = 250;
//int drawsteps = 250;
void setup() {
size(500, 500);
background(0, 191, 255);
smooth();
}
void draw() {
beginShape();
stroke(72, 61, 139);
for (float t = 0; t < drawsteps *TWO_PI; t += 4) {
float x = centerX + t * cos(t);
float y = centerY + t * sin(t);
float u = centerX + (t + 4) * cos(t + 4);
float s = centerX + (t + 4) * sin(t + 4);
curveVertex(x, y);
line(x, y, u, s);
}
endShape();
}
// void draw() {
// for (z = 0; z > 4550; z++) {
// float x = z * cos(theta);
// float y = z * sin(theta);
// noStroke();
// fill(0);
// ellipse(x + width/2, y + height/2, 4, 4);
// theta += 1;
// z += 1;
// }
// }
// void draw() {
// translate(width/2, height/2);
// for (int i = 0; i < 4550; i++) {
// float t = radians(i);
// float x = t * cos(t);
// float y = t * sin(t);
// point(x, y);
// }
// for (int j = 0; j > 4550; j++) {
// float t = radians(j);
// float k = t * cos(j);
// float l = t * sin(j);
// point(k, l);
// }
// }