New to processing and just need some quick guidance please

Hello!

I’m very new to processing and have been watching tons of code train videos. At the moment I’ve spent some time looking at projects from the openprocessing website and have had tons of fun with it.

There are some projects that I cant get to work and I cant figure out why: Brush Drawing 2 - OpenProcessing &&& Marielle Semente - OpenProcessing

Both are giving me error messages from the very beginning where the variables are declared. i.e:

var balls = [];
var seeds = [];
var trees = [];
var leaves = [];

It’s always whenever doing an array as above, the whole code is on the links above.

Any guidance is appreciated, sorry it comes as a dumb question for more experienced users!

1 Like

Processing is a multi-programming-language framework library family.
Those 2 sketches are written in JavaScript for Processing’s flavor p5.js:

2 Likes

Hi @NoobyDooby,

When I click links from your posts everything works fine !?

What do you try to do?
Are you trying to run that code in Processing PDE (java)?
That won’t work because that code isn’t made for it.

Cheers
— mnse

1 Like

Thank you for responding!

I am trying to run the code locally, so that I can tweak some things like the picture and the colors for example.

The code runs on the website but if I run it from the processing 4 locally on my laptop I get the errors.

Thanks for claryfing it wont work. How can I make this work for my testing purposes?

You need to run it in p5.js mode.

  • When you’re signed in, at the far right side, click at the icon next to your avatar to open a panel that shows a clickable “sketchxxxxxx.zip” file.
  • Unpack that file’s content into some folder of your choice.
  • There are numerous ways to run those files (HTML + JS).
  • PDE’s “p5.js mode” is 1 of them, as it’s already been mentioned by @javagar.
  • But a more better way is to install a local HTTP server and run it from there.
  • My HTTP server of choice is the npm pack “serve”:
  • For that 1st you’re gonna need to install JS runtime “Node.js”:
  • Once the installation is done, open the command line terminal and paste this: npm -g i serve
  • Last thing is creating a “.bat” file which will invoke “serve” at the current folder followed by opening your default browser:

“run.bat”

set port=%random%
start serve -l %port%
start http://localhost:%port%
  • Finally, place that file in the same folder you’ve unpacked your sketch files and run it.
3 Likes

I cant thank you enogh for that answer, thanks so much!!!

It worked and I can now start to make my own projects. Thank you for writing such detailed answer!

3 Likes