(sketch, node, sync)
| 11269 | * @return {p5} a p5 instance |
| 11270 | */ |
| 11271 | var p5 = function(sketch, node, sync) { |
| 11272 | |
| 11273 | if (arguments.length === 2 && typeof node === 'boolean') { |
| 11274 | sync = node; |
| 11275 | node = undefined; |
| 11276 | } |
| 11277 | |
| 11278 | ////////////////////////////////////////////// |
| 11279 | // PUBLIC p5 PROPERTIES AND METHODS |
| 11280 | ////////////////////////////////////////////// |
| 11281 | |
| 11282 | |
| 11283 | /** |
| 11284 | * Called directly before setup(), the preload() function is used to handle |
| 11285 | * asynchronous loading of external files. If a preload function is |
| 11286 | * defined, setup() will wait until any load calls within have finished. |
| 11287 | * Nothing besides load calls should be inside preload (loadImage, |
| 11288 | * loadJSON, loadFont, loadStrings, etc).<br><br> |
| 11289 | * By default the text "loading..." will be displayed. To make your own |
| 11290 | * loading page, include an HTML element with id "p5_loading" in your |
| 11291 | * page. More information <a href="http://bit.ly/2kQ6Nio">here</a>. |
| 11292 | * |
| 11293 | * @method preload |
| 11294 | * @example |
| 11295 | * <div><code> |
| 11296 | * var img; |
| 11297 | * var c; |
| 11298 | * function preload() { // preload() runs once |
| 11299 | * img = loadImage('assets/laDefense.jpg'); |
| 11300 | * } |
| 11301 | * |
| 11302 | * function setup() { // setup() waits until preload() is done |
| 11303 | * img.loadPixels(); |
| 11304 | * // get color of middle pixel |
| 11305 | * c = img.get(img.width/2, img.height/2); |
| 11306 | * } |
| 11307 | * |
| 11308 | * function draw() { |
| 11309 | * background(c); |
| 11310 | * image(img, 25, 25, 50, 50); |
| 11311 | * } |
| 11312 | * </code></div> |
| 11313 | * |
| 11314 | * @alt |
| 11315 | * nothing displayed |
| 11316 | * |
| 11317 | */ |
| 11318 | |
| 11319 | /** |
| 11320 | * The setup() function is called once when the program starts. It's used to |
| 11321 | * define initial environment properties such as screen size and background |
| 11322 | * color and to load media such as images and fonts as the program starts. |
| 11323 | * There can only be one setup() function for each program and it shouldn't |
| 11324 | * be called again after its initial execution. |
| 11325 | * <br><br> |
| 11326 | * Note: Variables declared within setup() are not accessible within other |
| 11327 | * functions, including draw(). |
| 11328 | * |
nothing calls this directly
no outgoing calls
no test coverage detected