Code viewer for World: LaQuica's P5 Mouse tracker

// Cloned by Prashasta Jung on 22 Sep 2022 from World "P5 Mouse tracker" by Starter user 
// Please leave this clone trail here.
 


// ==== Starter World =================================================================================================
// This code is designed for use on the Ancient Brain site.
// This code may be freely copied and edited by anyone on the Ancient Brain site.
// To include a working run of this program on another site, see the "Embed code" links provided on Ancient Brain.
// ====================================================================================================================




// Starter World for P5 AB API  




// ===================================================================================================================
// === Start of tweaker's box ======================================================================================== 
// ===================================================================================================================

// The easiest things to modify are in this box.
// You should be able to change things in this box without being a JavaScript programmer.
// Go ahead and change some of these. What's the worst that could happen?


AB.clockTick       = 20;    

AB.maxSteps        = 1000000;    

AB.screenshotStep  = 200;   
  
AB.drawRunControls = false;
	
const SKYCOLOR = "LightBlue";       // any format color that is accepted by P5 background()
                                    // https://p5js.org/reference/#/p5/background
	
const MUSIC_BACK  = '/uploads/starter/Defense.Line.mp3' ;

  
// ===================================================================================================================
// === End of tweaker's box ==========================================================================================
// ===================================================================================================================


// You will need to be some sort of JavaScript programmer to change things below the tweaker's box.





    AB.world.newRun = function()                 
    {
		// console.log ( "newRun" );
		ABWorld.init (  SKYCOLOR  ); 
    };


    AB.world.nextStep = function()                
    {
		// can put P5 instructions to be executed every step here, or in draw()  
 
        // fill color white
		fill(255, 255, 255); 
		
		// draw ellipses on desktop 
		// draw ellipse on mouse hover, wherever the mouse is, each step
		if ( AB.onDesktop() )   square(mouseX, mouseY, 40);         
    };

	

// draw ellipses on mobile   
// on touch there is no hover
// so respond directly to touch events rather than run on its own 
// https://github.com/processing/p5.js/wiki/p5.js-overview#mouse-and-touch-interaction

function touchStarted() 
{
    triangle(mouseX, mouseY, 80, 80); 
    // prevent default
    return false;
}



//---- setup -------------------------------------------------------
// Do NOT create a setup function 
// But you can create these functions.

function beforesetup()        // Optional
{
    // Anything you want to run at the start BEFORE the canvas is created 
}

function aftersetup()         // Optional
{
    // Anything you want to run at the start AFTER the canvas is created 	
}



//---- draw -------------------------------------------------------
// draw() is not needed. 
// Can use nextStep() or takeAction() instead.

function draw()               // Optional
{
	// can put P5 instructions to be executed every step here, or in nextStep()  
}





// --- music ----------------------------------------

 AB.backgroundMusic ( MUSIC_BACK );