Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ let mousePressY = 0;
// Remember whether bubble is currently being created
let creatingBubble = false;

// Put any asynchronous data loading in preload to complete before "setup" is run
function preload() {
// Load the JSON file and then call the loadData() function below
loadJSON('/assets/bubbles.json', loadData);
}

// Convert saved bubble data into Bubble Objects
function loadData(bubblesData) {
bubbles = [];
Expand All @@ -31,9 +25,11 @@ function loadData(bubblesData) {
}
}

function setup() {
async function setup() {
let p5Canvas = createCanvas(640, 360);

await loadJSON('/assets/bubbles.json', loadData);

// When canvas is clicked, call saveMousePress()
p5Canvas.mousePressed(saveMousePress);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function loadData(table) {
// Put object in array
bubbles.push(new Bubble(x, y, radius, name));
}
return table;
}

async function setup() {
Expand Down