We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I am a middle schooler and I need to use the void draw function. When I use it, it messes things up. My sketch is a very simple one, the illuminati creature from gravity falls, and when I use void draw, it adds thickness (strokeWeight) to things that are not supposed to be. But when I remove the void, the sketch is perfectly fine. Could you guys help me figure out what the problem is and how you fix it?
Here is my code:
void setup () {
size (200,200);
}
void draw () { fill(250,249,83); stroke(254,247,244); triangle(100,50,40,120,160,120); stroke(206,172,11,255); line(47,113,153,113); line(54,106,147,106); line(60,99,140,99); line(70,120,70,113); line(145,120,145,113); line(67,113,67,106); line(120,113,120,106); line(63,106,63,99); line(130,106,130,99); line(100,106,100,99); fill(255); stroke(0); ellipse(100,80,35,25); fill(0); ellipse(100,80,5,15); strokeWeight(5); strokeCap(SQUARE); strokeJoin(ROUND); line(65,122,65,150); strokeCap(ROUND); line(65,150,50,150); strokeCap(SQUARE); line(135,122,135,150); strokeCap(ROUND); line(135,150,150,150); strokeCap(SQUARE); line(145,102,180,90); line(55,102,29,90); rect(80,35,40,10); rect(95,10,10,30); triangle(80,101,80,111,100,107); triangle(100,107,120,101,120,111);
}
Answers
please edit post, highlight code, press ctrl-o
Ctrl o is open why would I need that
you either need to add background() as first thing in draw to clear the screen for every frame
OR as your image is static and non-interactive add noLoop() to setup() so that the picture is only drawn once.
the problem is the buildup of partially opaque items. there's a FAQ about this...
https://forum.processing.org/two/discussion/8075/why-are-text-and-graphics-so-ugly-and-blocky
Thank YOU!!! doing background() at the beginning of draw did not work, but noLoop did! Thanks!
(you need to specify a colour in the background() call)