Hi! I’m new to Processing and also to this forum.
I got some trouble with the void command; I couldn’t use a save(""); in a void. See an example below, when I execute it, it will say “ArrayIndexOutOfBoundsException: Coordinate out of bounds!”. How can I fix this, I want a file that Processing creates.
Thanks in advance !
String outfile = "data/a.png";
color[]mycolor=new color[10];
boolean saveit = true;
void setup(){
size(500,500);
mycolor[0]=color(200,200,0);
}
void draw(){
background(mycolor[0]);
if ( saveit ) save(outfile); // the subdirectory is created automatically
saveit = false; // do not save 60 files per sec.
}
You can refer to the reference to learn about save() function. To find the sketch folder in the PDE click the menu Sketch >> Show Sketch Folder and it shall display your sketch folder.
To get the location of your current created folder in your OP, you can add the following line right after you create the folder: println(Folder1.getAbsolutePath());
Finally, Folder1 should be replace with folder1 aka notice the lower case letter. Capital letter is reserved for naming classes and variables should begin with lower case. This is not an issue of your code but more of best practices to ensure your code is readable by others.