/r/processing

Photograph via snooOG

“Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology. There are tens of thousands of students, artists, designers, researchers, and hobbyists who use Processing for learning and prototyping.”—from Processing.org

Share your projects, news and questions about Processing or Processing.js here.


Getting Started & Tutorials:

(open to suggestions)


Weekly Challenges Archive


Rules:

Regarding help with school work:

  • asking for help with an assignment is OK
  • asking for someone to do an assignment for you is NOT OK
  • responding to a request for help with hints, suggestions or explanations is OK
  • responding to a request for help with a complete solution is NOT OK

/r/processing

27,409 Subscribers

25

WINDVANE

4 Comments
2024/05/16
01:00 UTC

2

Can I simplify these if statements? (Going between pages with mouseX, mouseY & mousePressed)

I have a lot of if statements, directing pages to other pages depending on where the mouse is clicked. Is there a way I can simplify these? I feel like copy and pasting 6 lines per page is unnecessary but I'm fairly new to processing. (Apologies, this is a long one).

 /********************
Project Title: Character Selection 
Description: Based off of World of Warcraft's Character Creation.     
********************/

I removed my void setup code because I'm not sure it's applicable. As well as all my PImage commands.

To make this post shorter, I am only including 4 blocks of code excluding void draw:

  • Alliance Body 1 Blank
  • Alliance Body 2 Blank
  • & an example of a page belonging to both Body 1 & Body 2

Please know there are about 28 of these pages and I'm slowly perishing, any help would be greatly appreciated. (Or any tutorials someone can recommend would be welcomed as well).

int page = 0;

  void draw() {
      println(mouseX, mouseY);
      if (page == 0) {
        background(bg[0]);
        fill(255, 150);
        textSize(34);
        text("Based off World of Warcraft", width/2, 24);
        fill(255);
        textSize(80);
        text("Character Selection", width/2, 75);
        textSize(54);
        text("Choose your Faction", width/2, 634);
    
        //********************ALLIANCE BUTTON POPMATRIX********************
        push();
        if ((mouseX > 152 && mouseX < 250) &&( mouseY > 700 && mouseY < 800)) {
          fill(54, 116, 255);
          textSize(50);
          text("Alliance", 200, 840);
        }
        textSize(160);
        text("]", 200, 765); // alliance symbol
    
        pop();
        //********************END: ALLIANCE BUTTON POPMATRIX********************
    
        //********************HORDE BUTTON POPMATRIX********************
        push();
        if ((mouseX > 350 && mouseX < 444) && ( mouseY > 700 && mouseY < 800)) {
          fill(255, 0, 0);
          textSize(50);
          text("Horde", 400, 840);
        }
        textSize(160);
        text("[", 400, 765); // horde symbol
    
        pop();
        //********************END: HORDE BUTTON POPMATRIX********************
      }// End: PAGE 0



      //**************************ALLIANCE BODY TYPE 1 BLANK (PAGE 1)************************
      if (page == 1) {//Alliance Body Type 1
        background(bg[1]);
        textSize(140);
        fill(255, 140);
        text("]", 535, 70); // alliance symbol
    
        //********************BACK BUTTON POP MATRIX********************
        push();
        if ((mouseX > 25 && mouseX < 150) && ( mouseY > 10 && mouseY < 80)) {
          fill(200);
        }
    
    
        if ((mouseX > 25 && mouseX < 150) && ( mouseY > 0 && mouseY < 80) && mousePressed) {
          page = 0;
        }
        fill(255);
        textSize(50);
        text("< Back", 90, 40);
    
        pop();
        //********************END: BACK BUTTON POP MATRIX********************
    
    
        image(body[1], 250, 100);
        image(body[2], 350, 100);
        image(raceAM[0], 75, 250);
        image(raceAM[1], 75, 350);
        image(raceAM[2], 75, 450);
        image(raceAM[3], 75, 550);
        image(raceAM[4], 75, 650);
        image(raceAM[5], 75, 750);
    
        if ((mouseX > 35 && mouseX < 115) && ( mouseY > 210 && mouseY < 285)) {
          fill(255);
          textSize(60);
          text("Draenei", 295, 165);
        }
        if ((mouseX > 35 && mouseX < 115) && ( mouseY > 310 && mouseY < 385)) {
          fill(255);
          textSize(60);
          text("Dwarf", 295, 165);
        }
        if ((mouseX > 35 && mouseX < 115) && ( mouseY > 410 && mouseY < 485)) {
          fill(255);
          textSize(60);
          text("Gnome", 295, 165);
        }
        if ((mouseX > 35 && mouseX < 115) && ( mouseY > 510 && mouseY < 585)) {
          fill(255);
          textSize(60);
          text("Human", 295, 165);
        }
        if ((mouseX > 35 && mouseX < 115) && ( mouseY > 610 && mouseY < 685)) {
          fill(255);
          textSize(60);
          text("Night Elf", 295, 165);
        }
        if ((mouseX > 35 && mouseX < 115) && ( mouseY > 710 && mouseY < 785)) {
          fill(255);
          textSize(60);
          text("Worgen", 295, 165);
        }
        if ((page == 1 && (mouseX > 35 && mouseX < 115) && ( mouseY > 210 && mouseY < 285) && mousePressed)) {
          page = 3;//DRAENEI M (PAGE 3)
        }
        if ((page == 1 && (mouseX > 35 && mouseX < 115) && ( mouseY > 310 && mouseY < 385) && mousePressed)) {
          page = 4;//DWARF M (PAGE 4)
        }
        if ((page == 1 && (mouseX > 35 && mouseX < 115) && ( mouseY > 410 && mouseY < 485) && mousePressed)) {
          page = 5;//GNOME M (PAGE 5)
        }
        if ((page == 1 && (mouseX > 35 && mouseX < 115) && ( mouseY > 510 && mouseY < 585) && mousePressed)) {
          page = 6;//HUMAN M (PAGE 6)
        }
        if ((page == 1 && (mouseX > 35 && mouseX < 115) && ( mouseY > 610 && mouseY < 685) && mousePressed)) {
          page = 7;//NIGHT ELF M (PAGE 7)
        }
        if ((page == 1 && (mouseX > 35 && mouseX < 115) && ( mouseY > 710 && mouseY < 785) && mousePressed)) {
          page = 8;//WORGEN M (PAGE 8)
        }
      }//End: PAGE 1



      //*****************************DRAENEI BODY TYPE 1 (PAGE 3)**********************
      if (page == 3) {
        background(bg[1]);
        textSize(140);
        fill(255, 140);
        text("]", 535, 70); // alliance symbol
        fill(255);
        textSize(60);
        text("Draenei", 295, 165);
    
        //********************BACK BUTTON POP MATRIX********************
        push();
        if ((mouseX > 25 && mouseX < 150) && ( mouseY > 10 && mouseY < 80)) {
          fill(200);
        }
    
    
        if ((mouseX > 25 && mouseX < 150) && ( mouseY > 0 && mouseY < 80) && mousePressed) {
          page = 0;
        }
        fill(255);
        textSize(50);
        text("< Back", 90, 40);
    
        pop();
        //********************END: BACK BUTTON POP MATRIX********************
    
        image(picAM[0], width/2, 600);
        image(body[1], 250, 100);
        image(body[2], 350, 100);
        image(raceAM[0], 75, 250);
        image(raceAM[1], 75, 350);
        image(raceAM[2], 75, 450);
        image(raceAM[3], 75, 550);
        image(raceAM[4], 75, 650);
        image(raceAM[5], 75, 750);
    
        if ((page == 3 && (mouseX > 35 && mouseX < 115) && ( mouseY > 310 && mouseY < 385) && mousePressed)) {
          page = 4;//DWARF M (PAGE 4)
        }
        if ((page == 3 && (mouseX > 35 && mouseX < 115) && ( mouseY > 410 && mouseY < 485) && mousePressed)) {
          page = 5;//GNOME M (PAGE 5)
        }
        if ((page == 3 && (mouseX > 35 && mouseX < 115) && ( mouseY > 510 && mouseY < 585) && mousePressed)) {
          page = 6;//HUMAN M (PAGE 6)
        }
        if ((page == 3 && (mouseX > 35 && mouseX < 115) && ( mouseY > 610 && mouseY < 685) && mousePressed)) {
          page = 7;//NIGHT ELF M (PAGE 7)
        }
        if ((page == 3 && (mouseX > 35 && mouseX < 115) && ( mouseY > 710 && mouseY < 785) && mousePressed)) {
          page = 8;//WORGEN M (PAGE 8)
        }
      }//End: PAGE 3



      //*************************ALLIANCE BODY TYPE 2 BLANK (PAGE 2)****************************
      if (page == 2) {
        background(bg[1]);
        textSize(140);
        fill(255, 140);
        text("]", 535, 70); // alliance symbol
    
        //********************BACK BUTTON POP MATRIX********************
        push();
        if ((mouseX > 25 && mouseX < 150) && ( mouseY > 10 && mouseY < 80)) {
          fill(200);
        }
    
    
        if ((mouseX > 25 && mouseX < 150) && ( mouseY > 0 && mouseY < 80) && mousePressed) {
          page = 0;
        }
        fill(255);
        textSize(50);
        text("< Back", 90, 40);
    
        pop();
        //********************END: BACK BUTTON POP MATRIX********************
    
        image(body[0], 248, 101);
        image(body[3], 350, 100);
        image(raceAF[0], 75, 250);
        image(raceAF[1], 75, 350);
        image(raceAF[2], 75, 450);
        image(raceAF[3], 75, 550);
        image(raceAF[4], 75, 650);
        image(raceAF[5], 75, 750);
    
        if ((mouseX > 35 && mouseX < 115) && ( mouseY > 210 && mouseY < 285)) {
          fill(255);
          textSize(60);
          text("Draenei", 295, 165);
        }
    
        if ((mouseX > 35 && mouseX < 115) && ( mouseY > 310 && mouseY < 385)) {
          fill(255);
          textSize(60);
          text("Dwarf", 295, 165);
        }
    
        if ((mouseX > 35 && mouseX < 115) && ( mouseY > 410 && mouseY < 485)) {
          fill(255);
          textSize(60);
          text("Gnome", 295, 165);
        }
    
        if ((mouseX > 35 && mouseX < 115) && ( mouseY > 510 && mouseY < 585)) {
          fill(255);
          textSize(60);
          text("Human", 295, 165);
        }
        if ((mouseX > 35 && mouseX < 115) && ( mouseY > 610 && mouseY < 685)) {
          fill(255);
          textSize(60);
          text("Night Elf", 295, 165);
        }
        if ((mouseX > 35 && mouseX < 115) && ( mouseY > 710 && mouseY < 785)) {
          fill(255);
          textSize(60);
          text("Worgen", 295, 165);
        }
    
        if ((page == 2 && (mouseX > 35 && mouseX < 115) && ( mouseY > 210 && mouseY < 285) && mousePressed)) {
          page = 9;//DRAENEI F (PAGE 9)
        }
        if ((page == 2 && (mouseX > 35 && mouseX < 115) && ( mouseY > 310 && mouseY < 385) && mousePressed)) {
          page = 10;//DWARF F (PAGE 10)
        }
        if ((page == 2 && (mouseX > 35 && mouseX < 115) && ( mouseY > 410 && mouseY < 485) && mousePressed)) {
          page = 11;//GNOME F (PAGE 11)
        }
        if ((page == 2 && (mouseX > 35 && mouseX < 115) && ( mouseY > 510 && mouseY < 585) && mousePressed)) {
          page = 12;//HUMAN F (PAGE 12)
        }
        if ((page == 2 && (mouseX > 35 && mouseX < 115) && ( mouseY > 610 && mouseY < 685) && mousePressed)) {
          page = 13;//NIGHT ELF F (PAGE 13)
        }
        if ((page == 2 && (mouseX > 35 && mouseX < 115) && ( mouseY > 710 && mouseY < 785) && mousePressed)) {
          page = 14;//WORGEN F (PAGE 14)
        }
      }//End: PAGE 2



      //*********************DRAENEI BODY TYPE 2 (PAGE 9)***************************
      if (page == 9) {
        background(bg[1]);
        textSize(140);
        fill(255, 140);
        text("]", 535, 70); // alliance symbol
        fill(255);
        textSize(60);
        text("Draenei", 295, 165);
    
        //********************BACK BUTTON POP MATRIX********************
        push();
        if ((mouseX > 25 && mouseX < 150) && ( mouseY > 10 && mouseY < 80)) {
          fill(200);
        }
    
    
        if ((mouseX > 25 && mouseX < 150) && ( mouseY > 0 && mouseY < 80) && mousePressed) {
          page = 0;
        }
        fill(255);
        textSize(50);
        text("< Back", 90, 40);
    
        pop();
        //********************END: BACK BUTTON POP MATRIX********************
    
        image(picAF[0], width/2, 600);
        image(body[0], 248, 101);
        image(body[3], 350, 100);
        image(raceAF[0], 75, 250);
        image(raceAF[1], 75, 350);
        image(raceAF[2], 75, 450);
        image(raceAF[3], 75, 550);
        image(raceAF[4], 75, 650);
        image(raceAF[5], 75, 750);
    
        if ((page == 9 && (mouseX > 35 && mouseX < 115) && ( mouseY > 310 && mouseY < 385) && mousePressed)) {
          page = 10;//DWARF F (PAGE 10)
        }
        if ((page == 9 && (mouseX > 35 && mouseX < 115) && ( mouseY > 410 && mouseY < 485) && mousePressed)) {
          page = 11;//GNOME F (PAGE 11)
        }
        if ((page == 9 && (mouseX > 35 && mouseX < 115) && ( mouseY > 510 && mouseY < 585) && mousePressed)) {
          page = 12;//HUMAN F (PAGE 12)
        }
        if ((page == 9 && (mouseX > 35 && mouseX < 115) && ( mouseY > 610 && mouseY < 685) && mousePressed)) {
          page = 13;//NIGHT ELF F (PAGE 13)
        }
        if ((page == 9 && (mouseX > 35 && mouseX < 115) && ( mouseY > 710 && mouseY < 785) && mousePressed)) {
          page = 14;//WORGEN F (PAGE 14)
        }
      }//End: PAGE 9
    
      //***********************END OF ALLIANCE BODY TYPES**************************

}//void draw

//********************************************************************************************
    void mousePressed() {
      if (page == 0 && (mouseX > 152 && mouseX < 250) && ( mouseY > 700 && mouseY < 800)) {
        page = 1;//alliance faction page
      } else if (page == 0 && (mouseX > 350 && mouseX < 444) && ( mouseY > 700 && mouseY < 800)) {
        page = 15;//horde faction page
      }
    
      //******************** IF STATEMENTS TO FOR ALLIANCE BODY 2********************
      else if (page == 1 && (mouseX > 315 && mouseX < 380) && ( mouseY > 65 && mouseY < 130)) {
        page = 2;
      } else if (page == 3 && (mouseX > 315 && mouseX < 380) && ( mouseY > 65 && mouseY < 130)) {
        page = 2;
      } else if (page == 4 && (mouseX > 315 && mouseX < 380) && ( mouseY > 65 && mouseY < 130)) {
        page = 2;
      } else if (page == 5 && (mouseX > 315 && mouseX < 380) && ( mouseY > 65 && mouseY < 130)) {
        page = 2;
      } else if (page == 6 && (mouseX > 315 && mouseX < 380) && ( mouseY > 65 && mouseY < 130)) {
        page = 2;
      } else if (page == 7 && (mouseX > 315 && mouseX < 380) && ( mouseY > 65 && mouseY < 130)) {
        page = 2;
      } else if (page == 8 && (mouseX > 315 && mouseX < 380) && ( mouseY > 65 && mouseY < 130)) {
        page = 2;
      }
      //********************END: IF STATEMENTS TO FOR ALLIANCE BODY 2********************
    
      //********************IF STATEMENTS TO FOR ALLIANCE BODY 1********************
      else if (page == 2 && (mouseX > 215 && mouseX < 280) && ( mouseY > 65 && mouseY < 130)) {
        page = 1;
      } else if (page == 9 && (mouseX > 215 && mouseX < 280) && ( mouseY > 65 && mouseY < 130)) {
        page = 1;
      } else if (page == 10 && (mouseX > 215 && mouseX < 280) && ( mouseY > 65 && mouseY < 130)) {
        page = 1;
      } else if (page == 11 && (mouseX > 215 && mouseX < 280) && ( mouseY > 65 && mouseY < 130)) {
        page = 1;
      } else if (page == 12 && (mouseX > 215 && mouseX < 280) && ( mouseY > 65 && mouseY < 130)) {
        page = 1;
      } else if (page == 13 && (mouseX > 215 && mouseX < 280) && ( mouseY > 65 && mouseY < 130)) {
        page = 1;
      } else if (page == 14 && (mouseX > 215 && mouseX < 280) && ( mouseY > 65 && mouseY < 130)) {
        page = 1;
      }
      //********************END: IF STATEMENTS TO FOR ALLIANCE BODY 1********************
    
      //******************** IF STATEMENTS TO FOR HORDE BODY 2********************
      else if (page == 15 && (mouseX > 315 && mouseX < 380) && ( mouseY > 65 && mouseY < 130)) {
        page = 16;
      } else if (page == 17 && (mouseX > 315 && mouseX < 380) && ( mouseY > 65 && mouseY < 130)) {
        page = 16;
      } else if (page == 18 && (mouseX > 315 && mouseX < 380) && ( mouseY > 65 && mouseY < 130)) {
        page = 16;
      } else if (page == 19 && (mouseX > 315 && mouseX < 380) && ( mouseY > 65 && mouseY < 130)) {
        page = 16;
      } else if (page == 20 && (mouseX > 315 && mouseX < 380) && ( mouseY > 65 && mouseY < 130)) {
        page = 16;
      } else if (page == 21 && (mouseX > 315 && mouseX < 380) && ( mouseY > 65 && mouseY < 130)) {
        page = 16;
      }
      //********************END: IF STATEMENTS TO FOR HORDE BODY 2********************
    
      //********************IF STATEMENTS TO FOR HORDE BODY 1********************
      else if (page == 22 && (mouseX > 215 && mouseX < 280) && ( mouseY > 65 && mouseY < 130)) {
        page = 15;
      } else if (page == 23 && (mouseX > 215 && mouseX < 280) && ( mouseY > 65 && mouseY < 130)) {
        page = 15;
      } else if (page == 24 && (mouseX > 215 && mouseX < 280) && ( mouseY > 65 && mouseY < 130)) {
        page = 15;
      } else if (page == 25 && (mouseX > 215 && mouseX < 280) && ( mouseY > 65 && mouseY < 130)) {
        page = 15;
      } else if (page == 26 && (mouseX > 215 && mouseX < 280) && ( mouseY > 65 && mouseY < 130)) {
        page = 15;
      } else if (page == 27 && (mouseX > 215 && mouseX < 280) && ( mouseY > 65 && mouseY < 130)) {
        page = 15;
      } else if (page == 28 && (mouseX > 215 && mouseX < 280) && ( mouseY > 65 && mouseY < 130)) {
        page = 15;
      }
      //********************END: IF STATEMENTS TO FOR HORDE BODY 1********************
    }//void mousePressed
4 Comments
2024/05/15
21:04 UTC

0

help i need to be done with my code today and i cant figure out how to finish it like i want

hey sorry to ask that last minute kinda, but so i have barely done any coding in my life, but for a digital design class i need to make a clock without numbers on processing, its due today. ive got my idea almost figured out, like i want the seconds to be sort of flashing, thats done. and so far ive done pretty much the same thing with minutes and hours, although id like it to be different. id like the circle for the minutes and the one for the hours to be moving every minute/hour, just like the action of a clock you know. Could someone help me with that? So far i have placed every circle on a particular area and now idk how to adapt it so that they move. Im putting the code down so that you can see by yourselves what i mean. btw im french so there are some french words in the code, you can ask if youve got any questions but should be ok.

int secondeavant=0;

int heureavant=0;

int minuteavant=0;

boolean clignote=false;

boolean clignoteagain=false;

boolean clignotetoujours=false;

void setup() {

size (900, 900) ;

background(#dec8da);

}

void draw() {

int s = second();

int m = minute();

int h = hour();

if (m>minuteavant) {

minuteavant=m;

if (clignote) {

clignote=false;

} else {

clignote=true;

}

} else {

minuteavant=m;

}

if (h>heureavant) {

heureavant=h;

if (clignoteagain) {

clignoteagain=false;

} else {

clignoteagain=true;

}

} else {

heureavant=h;

}

if (s>secondeavant) {

secondeavant=s;

if (clignotetoujours) {

clignotetoujours=false;

} else {

clignotetoujours=true;

}

} else {

secondeavant=s;

}

translate (80, 80);

stroke (#ebeba4);

for (int ligne = 1; ligne <7; ligne++) {

for (int colonne = 1; colonne<7; colonne++) {

if ( (ligne == 1) && (colonne == 6) ) {

if (clignote) {

fill(#9a7ba8);

} else {

fill (#3c1e4a);

}

} else {

noFill();

}

ellipse(colonne*100, ligne*100, 100, 100);

if ( (ligne == 5) && (colonne == 2) ) {

if (clignoteagain) {

fill(#c5d993);

} else {

fill (#607037);

}

} else {

noFill();

}

ellipse(colonne*100, ligne*100, 100, 100);

if ( (ligne == 4) && (colonne == 4) ) {

if (clignotetoujours) {

fill(#8db6c2);

} else {

fill (#dec8da);

}

} else {

noFill();

}

ellipse(colonne*100, ligne*100, 100, 100);

}

}

}

1 Comment
2024/05/15
10:10 UTC

1

how do you install processing on raspberry pi

complete raspberry pi/linux beginner. i downloaded most recent raspberry pi os on a Pi 4 Model B and I've installed processing 4.3 and it gives me a .tgz file with a bunch of folders and install/uninstall.sh. i have literally no idea what I'm doing and cannot find a straightforward answer online.

5 Comments
2024/05/15
00:27 UTC

0

All Eyes On Everything, art by me, 2024

It's a work that expresses the moment when we are interested in everything because of the development of AI, and we don't know what to focus our attention on.

Comment, please

All Eyes On Everything , 2024

0 Comments
2024/05/14
18:19 UTC

1

Help with camera

Hi! I’ve just recently begun coding, and I’m trying to make a simple 3d renderer using processing 2d. I’ve been trying to rotate an object around my camera, but then I realized that I don’t know the location of my camera, and I’m not really sure how I can implement one. Does anyone have any suggestions on how I can make this work? Thanks!

Here is the github: https://github.com/duocaleb/Teststuff

Sorry about the messy coding, as I said, I’m new to all this.

5 Comments
2024/05/09
18:03 UTC

2

Audio not being picked up by microphone

I'm trying to detect audio with my microphone to use the intensity to draw stuff, but it doesn't seem to be working. The microphone appears to be detected, I'm using the Minim library, but no luck.

I tried asking ChatGPT, tried different codes, tried using JavaScript and then taking it into Processing. Nothing worked. Any help would be appreciated.

2 Comments
2024/05/07
17:21 UTC

15

I made image to STL converter

For a university project i decided to create an application that can simplify the creation of multicolor single-layer models such as pins or keychains. Previously i had to create vector drawing, then export it into CAD program like fusion 360, extrude it, save manually each file and slice it. But with this tool i would skip first three steps. I wanted to make a tool that received a regular raster image as input, and gave separate STL files for each color as output. I know that there are some similar programs, but as i mentioned earlier it will be a project for my classes.
So after some time of work i introduce to you probably the most overcomplicated, unoptimized version of my project based on Processing IDE:
Here I will show you the capabilities of the program and the process of creating 3D models.

  • First of all you need to upload an image

Processing img cexk0lbg0wyc1...

  • Than you can adjust size, brightness, contrast and apply some filters like edge detection, blur, or noise.

Processing img hu3yj57s0wyc1...

  • Once you have achieved the desired result, you can quantize the image. This will reduce the number of colors in the image to the specified value, according to which the program will divide the image into different STL files. (Quantize function doesn’t work as good as it should, but this makes it possible to choose a more suitable option.)

Processing img yvs645lp1wyc1...

  • After the image has been quantized, you can apply a smoothing filter to it, which removes small details, since they can cause some issues when slicing the model, or will not be printed at all.

Processing img ue3difdd2wyc1...

  • Next you need to save the result. The program will save several versions of the image: processed by filters, quantized, quantized smoothed, and B&W images separated by color.

Processing img 0npv83ly2wyc1...

Processing img sk3649iz2wyc1...

Because I chose 4 colors, the program created 4 different images.

  • In the end, you can adjust the required height of the models (in my case I use 0.4 mm, that is, 2 layers) and also the resolution/size of future models. All images used by the program have a resolution of 512*512 pixels. It means with 10 PPM the model will have a size of 51.2*51.2 mm. You click on convert button and the program will save separate STL files.

Processing img qq7j7y744wyc1...

As I said, the program is crude, the STL files turn out to be very unoptimized, which is why they take up about several megabytes. I posted this project on GitHub, I don't really know how to use it, but if you want to experiment with this program or improve it, you have the opportunity.

Processing img jjmr196k7wyc1...

Also this program can be used not only for its intended purpose. The resulting pictures sometimes come out very interesting in a visual style, like pixel art.

Processing img 034fmuaa5wyc1...

Processing img bixtovaa5wyc1...

Processing img 2aztdvaa5wyc1...

And I also want to share the first real test of printing processed images in this program. To make the pins sufficiently distinguishable, I simplified the picture in regular Windows Paint and painted over all unnecessary parts.

Processing img cm62k7x26wyc1...

Processing img wtlb0jo46wyc1...

Processing img fcvpv74h6wyc1...

Processing img vk2mstrl6wyc1...

There is a link to a gitHub page of this project: https://github.com/Pavelruh/ImageToSTLConverter

I hope my project interests you and you have suggestions for improving it. At least it was quite fun and challenging to create it.

10 Comments
2024/05/07
00:41 UTC

1

FPS

i'm just wondering how do we use FPS in calculation of speed of moving items in the application?

1 Comment
2024/05/05
16:57 UTC

0

Minimum macOS for current or older versions?

Hey guys, i've searched to no avail but i#m looking for the latest version of processing that I can run on macOS 10.4 tiger. the mac is going to waste and i'm looking to make as much use out of it as possible,but cant find what the last version supported was. Of course I could try bang linux on it and do it that way, but as its my only macOS device, and me liking that OS, id prefer to see if my current processing sketches work or can be transcribed down.

When the mac was current processing was just transitioning to version 2 I believe. I know I ran v1 and maybe v2 back around 2009

Is there a list of min macOS versions for each version of processing somewhere? I may be being really thick so apologies and thanks in advance.

edit: alternatively, if processing three or ideally four are not provided for such an ancient mac, would it be possible to compile it myself to do so?

0 Comments
2024/05/04
21:57 UTC

7

Evolve processing animations using AI

Hello good people

I built something fun I'd like to share:

https://douwe.com/projects/processing_evolved

As you can see it starts out with a simple red block rendered using processing. Underneath it sits an chatgpt style prompt. You an enter instructions on how to change what you see. The AI will create a new processing program for you. You can also see what other people have done by just following the arrows back and forth. At some point you can get to something crazy like:

https://douwe.com/projects/processing_evolved/fractal_fusion_frenzy

Just looking for freedback

17 Comments
2024/05/04
21:50 UTC

5

Physarum Slime Mold Simulation with GUI!

A friend and I built a Phyasrum slime mold simulation for university in Processing and wanted to share it here. It has a GUI to control all parameters, start formations, colors, etc. It might be difficult at first to generate different patterns but once you got a hang of it you'll get beautiful results like in the image below!

You can find the sketch and a presentation of how it works here on GitHub:

https://github.com/theopfr/physarum-simulation

Examples:

https://preview.redd.it/wu5w5imebdyc1.png?width=1920&format=png&auto=webp&s=12d56542b21a9f8014657e8768dd787562f41589

1 Comment
2024/05/04
08:11 UTC

14

I've been developing a 3D version of particle life that leads to some pretty interesting, creature like behaviors. If anyone is interested there's a tutorial link in the comments.

5 Comments
2024/05/03
05:30 UTC

1

Processing Video Player: Issue with Switching from Reverse to Forward

I am trying to built a processing video player with the usual features (play/pause, reverse, speed control) . When I switch from reverse to forward playback, the video gets stuck at the point where I initially reversed it.

 void togglePlayPause() {
      if (isPlaying) {
        myMovie.pause();
        playPauseButton.setLabel("Play");
      } else {
        myMovie.play();
        playPauseButton.setLabel("Pause");
      }
      isPlaying = !isPlaying;
    }
    
    void toggleReverse() {
      speed = -speed; // Toggle between forward and reverse at the current speed
      myMovie.speed(speed);
      println("Reverse button clicked!");
    }

I tried the common fix of saving the time, stopping/restarting the video, and jumping, but it's not working.

Can anyone suggest why the video might be getting stuck? Are there Processing-specific quirks to be aware of?

0 Comments
2024/05/03
03:10 UTC

0

Can anyone help me with this?

I have an arduino sonic detector connected. It keeps saying "Nan" like not a number.

I checked the code and it seems there is nothing wrong.

3 Comments
2024/05/02
10:14 UTC

1

Uploading to open processing

Trying to upload a sketch to open processing but it comes back with a blank screen with only text (no assets)

Could possibly be due to use of minim library

Any guidance? lol

1 Comment
2024/05/01
16:16 UTC

2

Using HDMI input as video input using Video library

Hi. I wanna know if i can use the video input coming through HDMI and display it inside a processing sketch. What i mean is this:
I have a video output from a device (not a camera) through HDMI. I want to plug this HDMI to my pc and use the video coming from it in a Processing sketch as a view port for this video. Is this possible? Preferably in P3D if possible. Thank you in advance.

3 Comments
2024/04/30
09:13 UTC

4

Gradient + mouse + noise

Hello everyone,
I would like to be able to create a gradient visual that animates based on mouse placement.
In the photo is the type of visual I want to create and an example I found : https://openprocessing.org/sketch/1917381
, but it's in P5.js and I don't really understand the shaders. Do you think it's possible to do this in Processing? To achieve the same result, where can I start? I'm open to any resources.
As you've understood, I'm really a beginner in this kind of thing but I'm interested!

Thank you very much !!

https://preview.redd.it/iist3lvajfxc1.jpg?width=1236&format=pjpg&auto=webp&s=cc8608ce7f5302ebeb34681ed2fea0ae440478b5

4 Comments
2024/04/29
14:36 UTC

80

A game I'm making with Processing as the graphics engine

6 Comments
2024/04/27
15:09 UTC

1

Can't find out why this shape is not smooth

Hi everyone,

I am working on a for fun project with organic "wood" rings.
I can't get to the solution of why there are 2 sharp corners in the bezier curves on the right side...
Ideally I want each ring to be completely smooth.
I will be very glad for all tips!

EDIT: code copying

Here is the code I am using:

int numCircles = 13; // Number of circles
float smallestSize = 60; // Size of the smallest circle
float biggestSize = 150; // Size of the biggest circle
float scaleFactor = 1.2; // Exponential scale factor
float[] circleSizes = new float[numCircles]; // Sizes of circles

void setup() {
  size(900, 900);
  background(255);
  smooth();

  // Initialize circle sizes
  float size = smallestSize;
  float growthFactor = (biggestSize - smallestSize) / (pow(scaleFactor, numCircles - 1) - 1);
  for (int i = 0; i < numCircles; i++) {
    circleSizes[i] = size;
    size += growthFactor * pow(scaleFactor, numCircles - i - 1); // Modified exponential growth
  }

  // Set center
  float centerX = width / 2;
  float centerY = height / 2;

  // Draw the circles
  for (int i = 0; i < numCircles; i++) {

    float x = centerX;
    float y = centerY;
    size = circleSizes[i];
    drawBark(x, y, size, map(size, smallestSize, biggestSize, 0.05, 0.1));
  }
}

void drawBark(float x, float y, float size, float step) {
  noFill();
  strokeWeight(2);
  stroke(#000000);

  beginShape();
  float[] barkPointsX = {51.8, 57.1, 44.6, 27.4, 10.2, -11.6, -24.9, -38.2, -43, -37.4, -31.9, -15.9, 3.7, 23.2, 46.5, 51.8}; // Added the starting point again
  float[] barkPointsY = {-18.2, -0.4, 21.8, 33.2, 44.6, 45.3, 35.3, 25.4, 4.9, -13.1, -31.2, -46.9, -48.1, -49.3, -36, -18.2}; // Added the starting point again
  for (int i = 0; i < 16; i++) {
    float newX = barkPointsX[i] * size/100;
    float newY = barkPointsY[i] * size/100;
    curveVertex(x + newX, y + newY);
  }
  endShape(CLOSE);
}
5 Comments
2024/04/26
13:39 UTC

2

How to bypass windows defender false flag

A lot of itch.io developers have managed to somehow bypass this.
While I can specify to players about how they can get around it, it will still make people suspicious, since there is no way for me to prove that it is not a virus.

0 Comments
2024/04/26
11:52 UTC

1

how to smooth some shapes in processing?

Hello everyone!

I am exploring ways to process graphics in Processing; for instance, given the following rectangles, I would like to transform them into a slope.

What is the simplest and most feasible way to do this? And, does Processing offer any built-in APIs for it?

Thanks for help!

https://preview.redd.it/cso189n1rswc1.png?width=139&format=png&auto=webp&s=4aac33d5f6df3ece0a6d6e7e341e405a93d42d26

1 Comment
2024/04/26
09:59 UTC

1

constrain a player to some boundaries

hi, im a beginner et im looking for the player to stay inside the white PShape i displayed here. Im starting to think im gonna have to use && on multiple rectangles since im gonna need straight lines to do what i wanna do.

https://preview.redd.it/jofz1e58jowc1.png?width=997&format=png&auto=webp&s=698a169fc8f074f1f0e6f1920554a9672a74dbd7

1 Comment
2024/04/25
19:47 UTC

1

Looping Image

I don't expect to get a response. I'm simply out of ideas. I am, at the moment, defeated. My beginners tech literacy class is learning how to program in processing. My assignment is to just make whatever I want and explain it. For the last 4 days I've been working on trying to make a looping image that scrolls across the bottom of the window.

I'm simply out of ideas. I tried to do it with math and values but it only ran the equation once despite being in draw with no noLoop(). I tried to make it work on a 2D circle. But I couldn't get the coordinate without it being 3D. I tried it with a cylinder and that didn't work. I tried making it into a looping gif but processing 4.0 does not accept gifs and the add-on library is only valid up until 3. I tried to make it into a Sprite with a sheet with and without an array list and that didn't work. I don't know what else to do.

6 Comments
2024/04/25
04:04 UTC

1

Loading video with transparent background

Hey everyone! I'm trying to display a recorded video with transparent background but, as the video goes by, every frame gets "froze" in the screen, like a glitch effect. How do I display this video without this glitch, just one frame at a time?

import processing.video.*;

Movie video;

void setup() {
  fullScreen();
  video = new Movie(this, "SPOTLIGHT.mov");
  video.loop();
  
}

void movieEvent (Movie video) {
  video.read();
  
}

void draw() {
   image (video, 0, 0);
}

Its probably because of void draw() but idk how to display videos without it lol

An image to show whats happening, the animation is spinning 360º:

https://preview.redd.it/ocd4bjcbwiwc1.png?width=1920&format=png&auto=webp&s=911d74ab6d3daf4e9f753e912ae7120a815ea4ba

2 Comments
2024/04/25
00:45 UTC

3

Delay problem (Processing Sound Library

Hi there! I've been having a lot of success lately with Processing, but I've hit a bump on the road and need some guidance. Especially with the delay. I've basically gotten a bunch of sounds going on now through an array and a different sound is playing every time the scene changes. Now I want to have the delay effect change as well (which I can figure out myself) with every scene change, but I can't even seem to get the delay itself working. I've tried putting it in the if statement, void setup and void draw. Here's my code so far:

import processing.sound.*;
SoundFile[] file = new SoundFile[20];
Delay delay;

float modulo = 20;
int count;

float noiseforw, forw = 0;
float noiseScale = .2;

void setup() {
  size(900, 900);
  rectMode(CENTER);
  noStroke();

  //load string of soundfiles
  for (int i=0; i<file.length; i++) {
    file[i] = new SoundFile(this, "clicky"+i+".wav");
  }

  // create a delay effect
  delay = new Delay(this);
}

void draw() {
  background(0);
  int tilesX = 32;
  float mag = width * 0.4;
  forw = forw + 0.01;
  noiseforw = noiseforw + 0.0002;

  translate(width/2, height/2);


  if (frameCount % int(random(10, 120)) == 0) {
    modulo = int(random(1, 20));
    int selector = int(map(modulo, 1, 20, 0, file.length));
    file[selector].play();
    delay.process(file[selector], 5);
    delay.time(.1);
    delay.feedback(0.8);  
  }  
  int m = int(modulo);
  int selector2 = int(map(modulo, 1, 20, 0, file.length-1));
  

  
  for (int i = 0; i < tilesX; i++) {

    float x = map(i, 0, tilesX-1, -mag, mag);
    float bright = noise(i*noiseScale+noiseforw*m, i*noiseScale);

    if (i % m == 0) {
      rect (x, 0, 10, 280);
    } else {
      rect (x, 210-420*bright, 10, 70*bright*2);
    }
  }
}

2 Comments
2024/04/23
18:47 UTC

2

processing.py

I want to know how to import cv2 and media pipe in processing.py. Can anyone teach me?

7 Comments
2024/04/22
15:27 UTC

11

generative pattern made for a college class with p5.js

0 Comments
2024/04/21
23:49 UTC

41

I made this for fun

4 Comments
2024/04/21
15:25 UTC

Back To Top