xxxxxxxxxx
36
let datainfo;
let value = 10;
function preload() {
let url =
'https://jsonplaceholder.typicode.com/todos/' + value;
datainfo = loadJSON(url);
}
function setup() {
createCanvas(400, 400);
//noLoop();
textSize(24);
noStroke();
}
function draw() {
//console.log(datainfo.id, datainfo.title, datainfo.completed);
text(datainfo.title, 80, 100);
text(datainfo.id + ".", 80, 200);
text(datainfo.completed, 120, 200);
signal();
}
function signal() {
if (datainfo.completed == false) {
fill(200, 100, 100);
ellipse(200, 100, 100);
} else {
fill(100, 200, 100);
ellipse(300, 24, 24);
}
}