Running sketch from OpenProcessing.org in PDE

Hi… I’m really new to processing and I need help figuring out why so many errors are occuring on this sketch from openprocessing… The link is https://www.openprocessing.org/sketch/424983 . THANKS

Sketch seems to be working. Are you trying to run the code in the processing ide in java mode? Because the sketch is written in JavaScript, not Java. If that’s the case, just switch the mode in processing from java to p5.js.

1 Like

Yeah I was originally trying to run it in Java mode… I just tried to install p5.js and run it in that mode however it gives me the error:

“Cannot change mode,
because “p5.js” mode is not compatible with current mode”

Not sure why - Also the JavaScript mode is greyed out in the install browser so I do not think it is compatible with the newest version of processing anymore. Any ideas?

Thanks for your response!

Make sure you have the processing file saved somewhere, and that you reference the sketch file in the index.html file. For example, if you called it sketch.js, the index.html file should be:

<html>
<head>
  <meta charset="UTF-8"> 
  <script language="javascript" type="text/javascript" src="libraries/p5.js"></script>
  <script language="javascript" type="text/javascript" src="sketch.js"></script>
  <style> body {padding: 0; margin: 0;} </style>
</head>

<body>
</body>
</html>

Also, make sure you have the font AvenirNextLTPro-Demi.otf in the same directory as your sketch.js file. If you don’t have that font, you can substitute for any other font.

EDIT: And one more thing, don’t forget to credit the original author of the sketch!

1 Like

This error:

should go away if you restart Processing and then when it’s started again, switch to p5.js mode.

As mentioned, the trick to getting this code up and running is loading the font, either using the current font of defining a new font and adding it to the folder where the “sketch.js” file lives.

1 Like