# Spirals that get smaller for school project

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?

why not connect the ?known? points to a shape? any curve

for a shape of a spiral with a changing width try a TRIANGLE shape spiral1

or test spiral2 ( i mod your code )

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 x = t * cos(t);
//     float y = t * sin(t);
//     point(x, y);
//   }
//   for (int j = 0; j > 4550; j++) {
//    float k = t * cos(j);
//    float l = t * sin(j);
//    point(k, l);
//   }

//  }
``````

This is what I currently have running.

``````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 &lt; 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();
}
``````

Please format your code using `</>` in the message editor and press `Ctrl+T` in the processing code editor.

ok, is that what you want?
you could loose the line

``````line(x, y, u, s);
``````

and i see a hypnotic effect with

``````t += PI/2
``````

try

``````int drawsteps = 250, cgreen = 0;

void setup() {
size(500, 500);
println("use [+] and [-]");
}

void draw() {
background(150,cgreen, 0);
stroke(0, 0, 150);
strokeWeight(3);
noFill();

translate(width/2,height/2);

beginShape();
for (float t = 0; t < drawsteps *TWO_PI; t += PI/2+tadd) {
float x = t * cos(t);
float y = t * sin(t);
curveVertex(x, y);
}
endShape();
}

void keyPressed(){
if ( key == '+' ) { tadd = 0.015; cgreen = 150;}
if ( key == '-' ) { tadd = 0.0;  cgreen = 0;}
}
``````

Will test this out and see how it all works. Been re-watching some online tutorials, and I think I know some stuff that’ll help. Thank you!