We are about to switch to a new forum software. Until then we have removed the registration on this forum.
// Using Processing-3.3 // The stroke color defaults to black if no stroke command is issued. // In the code I was expecting the rectangle to have a black stroke color. // The ellipse has the expected blue stroke color. // The line has the expected green stroke color.
// Why does the rectangle have a green stroke color?
void setup() { size(480,420); background(220); }
void draw() { rect(100,200,100,100); // Expect this to have a black stroke color stroke(255,0,0); strokeWeight(3); stroke(0,0,255); ellipse(240,80, 115,115); stroke(0,255,0); line(5,5,400,310); }
Answers
Move background() to top of draw(), maybe? :-/
Putting "background(220);" as first line of the "draw" loop made no change. Thanks for the suggestion.
https://forum.Processing.org/two/discussion/15473/readme-how-to-format-code-and-text
GoToLoop, THANK YOU! Also, where is the information for proper posting? PapaK
You mean, where that post is located? It's the 2nd top announcement:
https://forum.Processing.org/two/discussions
Actually I am looking for the "etiquette" rules and suggestions.
https://forum.Processing.org/two/discussion/8042/processing-forum-rules-and-advices
// Using Push and Pop around part of the code // displays the stroke colors as I am expecting, // the rectangle now has a black border. // Now I notice the the strokeCap(PROJECT) appears to be applied // to the line before the it. // Is this a bug or am I not understanding how the code should work? // I am not expecting something to change before I actually change it.
void setup() { size(480,420); //background(220); }
void draw() { background(220); rect(100,200,100,100); stroke(255,0,0); strokeWeight(5); stroke(0,0,255); ellipse(240,80, 115,115); stroke(0,255,0); line(30,150,430,150); pushMatrix(); strokeWeight(9); strokeCap(PROJECT); line(30,170,430,170); popMatrix(); stroke(0,0,0); strokeWeight(1); line(430,140,430,189); }
https://Processing.org/reference/pushStyle_.html
https://Processing.org/reference/noLoop_.html
GoToLoop, Thank you. That makes perfect sense! PapaK