Code viewer for World: CORS image demo

// show image pulled in with CORS proxy from non-CORS site

var url  =   "https://www.eait.net/style/images/banner3.jpg";



// Wikimedia is CORS anyway
// "https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/London_Eye_Twilight_April_2006_square_crop.jpg/768px-London_Eye_Twilight_April_2006_square_crop.jpg";

// non-CORS
// "https://humphryscomputing.com/Images/me.2018.jpg";
// "https://oaidalleapiprodscus.blob.core.windows.net/private/org-40iQNGaSEIUpJn6KFvDbuS2H/user-rBCpKLfZtN5HiJzYhSscbj46/img-5EkzvnDBfFkjXQTA78elRY45.png?st=2024-02-25T10%3A26%3A12Z&se=2024-02-25T12%3A26%3A12Z&sp=r&sv=2021-08-06&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2024-02-24T19%3A05%3A07Z&ske=2024-02-25T19%3A05%3A07Z&sks=b&skv=2021-08-06&sig=D8QzpGbPEHqgyR6yQECgN6fnDR2EzqA/smTJsZM6L08%3D";


// var curl = "https://corsproxy.io/?" + encodeURIComponent(url);



 var img;

function preload() 
{
  //      img = loadImage ( url );                // fails
     img = loadImage ( AB.cors (url) );      // works
}

 
 
const objectsize    = 200;      // size of object   

const anglechange   = 0.01;     // how much the rotate angle changes each step 

var angle = 0;                  // rotate angle starts at 0  


function setup()         
{
  createCanvas ( ABWorld.fullwidth(), ABWorld.fullheight(),  WEBGL );
}

function draw()          
{
    background("lightblue");    // background color 
       texture(img);        	
    
    rotateX(angle);             // set each dimension rotation angle to "angle"
    rotateY(angle);
    rotateZ(angle);
  
    box(objectsize);            // draw a cube of this size 
  
    angle = angle + anglechange ;       // change angle each step to get rotate movement
}