Loading...
Logo
Processing Forum
Looking at LoadImage examples on processingjs ported from processing  -- none of the images seem to load... Does LoadImage not work on processingjs? 

Replies(1)

See  http://processingjs.org/reference/articles/p5QuickStart, the section  "Processing.js has to cheat to simulate Processing's synchronous I/O".

Images can be preloaded with the @pjs preload directive (at least until the loadXXXXXX methods can be made synchronous):

  1. /* @pjs preload="picture.jpg"; */  
  2. PImage img;  
  3.   
  4. void setup() {  
  5.   img = loadImage("picture.jpg");  
  6.   image(img, 0, 0);  
  7. }