xxxxxxxxxx
30
var img;
function preload() {
var corsAnywhere = "https://cors-anywhere.herokuapp.com/";
img = loadImage(corsAnywhere + 'https://images.pexels.com/photos/45201/kitty-cat-kitten-pet-45201.jpeg?cs=srgb&dl=animal-cat-cute-45201.jpg&fm=jpg');
}
function setup() {
createCanvas(2500, 2500);
// var apiKey = "a58f85b36fb241588c126abf0ff5cb3e";
// var url = "http://api.nytimes.com/svc/search/v2/articlesearch.json";
// var query = "?q=JavaScript&sort=newest";
// var corsAnywhere = "https://cors-anywhere.herokuapp.com/";
// // Here, I format the call to the API by joing the URL with the API key with the query string.
// loadJSON(corsAnywhere+url+query+"&api-key="+apiKey, gotData);
// function gotData(data) {
// // Grabbing a single headline from the results.
// var headline = data.response.docs[0].headline.main;
// createP(headline);
// }
}
function draw() {
background(220);
image(img, 0, 0);
}