xxxxxxxxxx
42
let url = 'https://official-joke-api.appspot.com/random_joke';
let loaded = false;
let jokeNo;
let JokeSetup;
let punchline;
function setup() {
createCanvas(400,400);
background(24,150,139);
}
function draw() {
ellipse(100,100,50,50);
getJoke();
}
function keyPressed() {
if (key == 'l') loadJSON(url, getJoke);
}
function getJoke(earthquakes) {
background(24,150,139);
jokeNo = earthquakes.id;
jokeSetup = earthquakes.setup;
punchline = earthquakes.punchline;
loaded = true;
print(jokeNo, jokeSetup, punchline);
textSize(25);
fill(255);
text(jokeSetup, 30,50,300,300);
textSize(18);
fill(200);
text(punchline, 30, 160);
}