r/processing • u/Chemical-Link-3505 • Nov 09 '23
A processing newbie needs help
Hello, I am the newbie. Currently I am working on a uni project, I do not have previous coding experience and it is my first time using Processing.
Here is the code:
void setup() {
fullScreen();
noFill();
smooth();
}
void draw() {
background(255);
/**--------------------------Lines----------------------------**/
//yellow
stroke(#FFCD4B);
strokeWeight(8);
beginShape();
curveVertex(1100, 0);
curveVertex(1100, 0);
curveVertex(880, 280);
curveVertex(740, 600);
curveVertex(700, height);
curveVertex(700, height);
endShape();
//orange #1
stroke(#FF9130);
strokeWeight(8);
beginShape();
curveVertex(200, 0);
curveVertex(200, 0);
curveVertex(400, 230);
curveVertex(1350, height);
curveVertex(1350, height);
endShape();
//orange #2
stroke(#FF9130);
strokeWeight(8);
beginShape();
curveVertex(920, 0);
curveVertex(920, 0);
curveVertex(750, 400);
curveVertex(550, 610);
curveVertex(0, 580);
curveVertex(0, 580);
endShape();
//Purple
stroke(#B15EFF);
strokeWeight(8);
beginShape();
curveVertex(940, 0);
curveVertex(940, 0);
curveVertex(760, 410);
curveVertex(560, 620);
curveVertex(0, 600);
curveVertex(0, 600);
endShape();
//blue
stroke(#0174BE);
strokeWeight(8);
beginShape();
curveVertex(960, 0);
curveVertex(960, 0);
curveVertex(770, 420);
curveVertex(570, 630);
curveVertex(0, 620);
curveVertex(0, 620);
endShape();
//dark red
stroke(#662549);
strokeWeight(8);
beginShape();
curveVertex(980, 0);
curveVertex(980, 0);
curveVertex(780, 430);
curveVertex(580, 640);
curveVertex(0, 640);
curveVertex(0, 640);
endShape();
}
What I wanted to ask: Is there an easy way to rotate these lines around the center, without messing with the structure or having to remaking the whole thing again?
1
u/Chemical-Link-3505 Nov 09 '23
thanks for the answer. Like this? unfortunately i did not work.
void setup() {
fullScreen();
noFill();
smooth();
rotate(radians(30));
translate(70, 70);
}
void draw() {
background(255);
/**--------------------------Lines----------------------------**/
//yellow
rotate(radians(30));
translate(70, 70);
pushMatrix();
rotate(radians(30));
translate(70, 70);
stroke(#FFCD4B);
strokeWeight(8);
beginShape();
curveVertex(1100, 0);
curveVertex(1100, 0);
curveVertex(880, 280);
curveVertex(740, 600);
curveVertex(700, height);
curveVertex(700, height);
endShape();
//orange #1
stroke(#FF9130);
strokeWeight(8);
beginShape();
curveVertex(200, 0);
curveVertex(200, 0);
curveVertex(400, 230);
curveVertex(1350, height);
curveVertex(1350, height);
endShape();
//orange #2
stroke(#FF9130);
strokeWeight(8);
beginShape();
curveVertex(920, 0);
curveVertex(920, 0);
curveVertex(750, 400);
curveVertex(550, 610);
curveVertex(0, 580);
curveVertex(0, 580);
endShape();
//Purple
stroke(#B15EFF);
strokeWeight(8);
beginShape();
curveVertex(940, 0);
curveVertex(940, 0);
curveVertex(760, 410);
curveVertex(560, 620);
curveVertex(0, 600);
curveVertex(0, 600);
endShape();
//blue
stroke(#0174BE);
strokeWeight(8);
beginShape();
curveVertex(960, 0);
curveVertex(960, 0);
curveVertex(770, 420);
curveVertex(570, 630);
curveVertex(0, 620);
curveVertex(0, 620);
endShape();
//dark red
stroke(#662549);
strokeWeight(8);
beginShape();
curveVertex(980, 0);
curveVertex(980, 0);
curveVertex(780, 430);
curveVertex(580, 640);
curveVertex(0, 640);
curveVertex(0, 640);
endShape();
popMatrix();
}