Code viewer for World: P5 Particle System (clone ...

// Cloned by Venkatraman Palani on 27 Sep 2023 from World "P5 Particle System" by Starter user 
// Please leave this clone trail here.
 



// Starter World for P5 plain API  
// This demonstrates taking an existing P5 World and porting it to Ancient Brain 

  



// --- The P5 code ----------------------------------------------------------------------------------------------
// This is identical to P5 example "Particle System" 
// https://p5js.org/examples/simulate-particle-system.html
// except changed canvas width, height 


var system;

function setup() {
	
  // --- This is the only change ----------------------------------------------------------------------------------------------
  // createCanvas(720, 400);
  createCanvas ( ABWorld.fullwidth(), ABWorld.fullheight() );	
  
  // optional - help the AB system find and position the canvas - probably not needed
  //    	var c = createCanvas ( ABWorld.fullwidth(), ABWorld.fullheight() );			 
  //		ABWorld.setCanvas ( c );		 
  // --- End of the only change -----------------------------------------------------------------------------------------------

  system = new ParticleSystem(createVector(width/2, 50));
}


function reSize()		 
{
	resizeCanvas ( ABWorld.fullwidth(), ABWorld.fullheight() ); 
	background(51);
}

if ( AB.onDesktop() )	window.addEventListener ( "resize", 			function() { 	reSize();  	 	});
else					window.addEventListener ( "orientationchange", 	function() { 	reSize();  	 	});
 
// --- End of optional addition -------------------------------------------------------------------------------------------
 

var ifrm = document.createElement('iframe');
ifrm.setAttribute('id', 'ifrm'); // assign an id

//document.body.appendChild(ifrm); // to place at end of document

// to place before another page element
var el = document.getElementById('marker');
el.parentNode.insertBefore(ifrm, el);

// assign url
ifrm.setAttribute('src', 'https://jupyterlite.github.io/demo/repl/index.html?kernel=python&toolbar=1');