Code viewer for World: P5 on canvas

AB.clockTick       = 20;    

AB.maxSteps        = 1000000;    

AB.screenshotStep  = 200;   
  
AB.drawRunControls = false;

var p5ready = false;
var p5canvas;

 

function setup() 
{
    // P5 function - runs once 
    // createCanvas should be in here 
     p5canvas = createCanvas($(document).width(), $(document).height());
     
    // canvas for threeworld in the API should be this object:
     threeworld.canvas = p5canvas.canvas;
}


function draw() 
{
    // P5 function - runs in infinite loop
    fill(255, 204, 0);                      // color yellow 
    ellipse(mouseX, mouseY, 80, 80);        // draw ellipse wherever the mouse is, each step 
}



function World() 
{ 
    this.newRun = function()                 
    {
        var s = document.createElement("script");
        s.src = "https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/p5.min.js";  
        s.onload = function() { p5ready = true; };        
        document.head.appendChild(s);  
    };


    this.nextStep = function()                
    {
        if ( ! p5ready ) return;
        
      // can put P5 instructions here 
      //   rect(300,300,300,50);
      //   ellipse(400, 500, 80, 80);
       
    };
}