|
| 1 | +{ |
| 2 | + "title": "p5.js 2.0: Loading Data (Images, APIs, JSON)", |
| 3 | + "description": "This video covers how to load external assets like images, JSON files, and data from APIs into your p5.js 2.0 sketches. Learn the fundamentals of asynchronous operations in p5.js using Promises with async/await.", |
| 4 | + "videoId": "25omXt_OjD4", |
| 5 | + "nebulaSlug": "codingtrain-how-to-load-data-with-p5js-20", |
| 6 | + "date": "2025-10-03", |
| 7 | + "languages": ["p5.js", "JavaScript"], |
| 8 | + "topics": ["async/await", "promises", "p5.js 2", "loading images", "API", "JSON", "Promise.all"], |
| 9 | + "canContribute": true, |
| 10 | + "relatedChallenges": [], |
| 11 | + "timestamps": [ |
| 12 | + { "time": "0:00:00", "title": "Hello!" }, |
| 13 | + { "time": "0:00:54", "title": "How to Load an Image in p5.js" }, |
| 14 | + { "time": "0:02:16", "title": "Asynchronous Code: promises, async, and await" }, |
| 15 | + { "time": "0:04:10", "title": "Common Mistakes to Avoid" }, |
| 16 | + { "time": "0:05:51", "title": "Loading Data from a Live API" }, |
| 17 | + { "time": "0:08:21", "title": "Loading Multiple Items in a Sequence" }, |
| 18 | + { "time": "0:09:12", "title": "Creating a Custom Loading Animation" }, |
| 19 | + { "time": "0:13:39", "title": "Faster Parallel Loading with Promise.all()" }, |
| 20 | + { "time": "0:16:48", "title": "Challenge for you!" } |
| 21 | + ], |
| 22 | + "codeExamples": [ |
| 23 | + { |
| 24 | + "title": "Loading a Single Image", |
| 25 | + "description": "A basic example of loading an image into a p5.js 2.0 sketch using async and await in setup().", |
| 26 | + "image": "choochoo.png", |
| 27 | + "urls": { "p5": "https://editor.p5js.org/codingtrain/sketches/NPKPIYhBR" } |
| 28 | + }, |
| 29 | + { |
| 30 | + "title": "Sequential Loading", |
| 31 | + "description": "Demonstrates JSON from the Dog API and then loading an image from the JSON.", |
| 32 | + "image": "dogs1.png", |
| 33 | + "urls": { "p5": "https://editor.p5js.org/codingtrain/sketches/lQxT7PTKC" } |
| 34 | + }, |
| 35 | + { |
| 36 | + "title": "API and Loading Animation", |
| 37 | + "description": "Demonstrates loading JSON from the Dog API and then creating a loading bar while fetching multiple images.", |
| 38 | + "image": "dogs2.png", |
| 39 | + "urls": { "p5": "https://editor.p5js.org/codingtrain/sketches/M_NGGyqr4" } |
| 40 | + }, |
| 41 | + { |
| 42 | + "title": "Parallel Loading with Promise.all", |
| 43 | + "description": "An example showing how to load multiple images in parallel for better performance using Promise.all().", |
| 44 | + "image": "kittens1.png", |
| 45 | + "urls": { "p5": "https://editor.p5js.org/codingtrain/sketches/MgrJuSvJt" } |
| 46 | + }, |
| 47 | + { |
| 48 | + "title": "Loading images with placeholders exercise", |
| 49 | + "description": "A demonstration of loading images from an array of files, displaying a placeholder while each image loads.", |
| 50 | + "image": "kittens2.png", |
| 51 | + "urls": { "p5": "https://editor.p5js.org/codingtrain/sketches/Ur6plDyKK" } |
| 52 | + } |
| 53 | + ], |
| 54 | + "groupLinks": [ |
| 55 | + { |
| 56 | + "title": "References", |
| 57 | + "links": [ |
| 58 | + { |
| 59 | + "icon": "π", |
| 60 | + "title": "p5.js 2.0 Beta", |
| 61 | + "url": "https://beta.p5js.org/", |
| 62 | + "description": "The beta website for p5.js 2.0 with updated references and examples." |
| 63 | + }, |
| 64 | + { |
| 65 | + "icon": "π", |
| 66 | + "title": "Promise.all", |
| 67 | + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all", |
| 68 | + "description": "MDN documentation on Promise.all for handling multiple promises in parallel." |
| 69 | + }, |
| 70 | + { |
| 71 | + "icon": "π¨", |
| 72 | + "title": "Dog API", |
| 73 | + "url": "https://dog.ceo/dog-api/", |
| 74 | + "description": "A public API for dog images used in the examples." |
| 75 | + } |
| 76 | + ] |
| 77 | + }, |
| 78 | + { |
| 79 | + "title": "Videos", |
| 80 | + "links": [ |
| 81 | + { |
| 82 | + "icon": "π", |
| 83 | + "title": "p5.js 2.0: async and await", |
| 84 | + "url": "/tracks/p5js-2.0/p5js-2.0/async-await", |
| 85 | + "description": "How to transition from p5.js 1.0 to 2.0 with async and await." |
| 86 | + }, |
| 87 | + { |
| 88 | + "icon": "π", |
| 89 | + "title": "Promises Part 1", |
| 90 | + "url": "/tracks/topics-in-native-javascript/js/promises-part-1", |
| 91 | + "description": "Learn more about JavaScript Promises in depth." |
| 92 | + }, |
| 93 | + { |
| 94 | + "icon": "π", |
| 95 | + "title": "Promises Part 2", |
| 96 | + "url": "/tracks/topics-in-native-javascript/js/promises-part-2", |
| 97 | + "description": "Continue learning about JavaScript Promises." |
| 98 | + } |
| 99 | + ] |
| 100 | + } |
| 101 | + ], |
| 102 | + "credits": [ |
| 103 | + { "title": "Editing", "name": "Mathieu Blanchette" }, |
| 104 | + { "title": "Animations", "name": "Jason Heglund" } |
| 105 | + ] |
| 106 | +} |
0 commit comments