Processing.js for Processing Devs: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 98: Line 98:
Both ways work, and you shouldn't let yourself get burdened by HTML and other web syntax until you feel you want to do other things with your web pages.
Both ways work, and you shouldn't let yourself get burdened by HTML and other web syntax until you feel you want to do other things with your web pages.


==3. Running your Processing.js Web Page==


In case it isn't obvious, you run your '''hello-web.pde''' sketch by loading your '''hello-web.html''' web page in a compatible browser.  Web browsers will provide you a way to load a local file, usually using the File menu and then ''Open File...''.  If you've saved the files above on a web server, you can use the remote URL instead.


==Things to Know as a Processing Developer using Processing.js==


no data dir
While Processing.js is compatible with Processing, Java is not JavaScript, and canvas has some differences from Java's graphics classes.  Here are some tricks and tips as you start working on more complex sketches in Processing.js.


libraries won't work, parts of Java won't work....
* Processing uses the concept of a '''data''' directory, where images and other resources are located.  Processing.js does not include this.  As a result, you should always provide file pages (e.g., images) that are relative to your web page, which is the norm on the web.
 
* Processing.js is compatible with Processing, but is not, and will never be, fully compatible with Java.  If your sketch uses functions or classes not defined as part of Processing, they are unlikely to work with Processing.js. Similarly, libraries that are written for Processing, which are written in Java instead of Processing, will most likely not work.
Confirmed users
656

edits

Navigation menu