Open main menu

CDOT Wiki β

Changes

Processing.js/HowTo

404 bytes added, 12:40, 21 August 2010
no edit summary
The alternative to preload caching is to put any image manipulation code inside the draw() loop and use checks to make sure the width and height are larger than 0 before manipulating pixels. This will cause frames to skip and pixel manipulation to happen only after an image has fully loaded.
 
'''NOTE:''' Because of the way preloading is being used in P.JS and the fact that you cant block the execution of a sketch while waiting for an image to load in the browser, both loadImage() and requestImage() function the same way in P.JS. Processing's JAVA implementation allows loadImage() to block sketch execution while an image loads up and requestImage() is used to preload images ahead of time.
Sample code
1
edit