can I use other JS libraries?

This is probably a basic question but I know very little about Javascript. When I use p5.js, am I writing my sketch code in Javascript itself rather than the usual Java-like language of Processing, or is p5.js something that compiles to Javascript?

And can I use other JS libraries? For instance I would like to integrate math.js (a symbolic computer algebra system) into some Processing code.

For that matter can I incorporate Java libraries into regular Processing code, should I happen to find a useful Java library? Can Java or other languages be linked with Processing?

Thanks,

Mike

Tagged:

Answers

  • Thanks. What I would like to understand is... so p5.js programs are written in Javascript, not compiled to Javascript? If they are written in Javascript then I guess any JS library can be imported.

  • So p5.js programs are written in Javascript, not compiled to Javascript?

    • p5.js is a Processing spinoff flavor library framework directly written in JS instead of Java.
    • Like Processing Java, p5.js is bound to a "canvas", and most of its API is geared towards "drawing" on that.
    • Like Processing, p5.js has a function which is called back at the beginning once only named setup().
    • And another named draw() which is called back by p5.js ad infinitum.
    • p5.js shouldn't have any problems when used together w/ other JS libraries.
    • Unless a library have their own particular needs which dispute p5.js' own demands.
    • And although p5.js is written is JS, our own sketches can be alternatively written in some other programming languages which are transpiled to JS, like TypeScript, CoffeeScript, etc.
Sign In or Register to comment.