JS viewer

Syntax-highlighted view of JS of World: P5 Raw : Animating




 


let x, y;                   //ball position

function setup()       
{
    createCanvas( 500, 500 );
    background(51);
    x = 100;                //initialize the ball position
    y = 100;
}


function draw()             
{
    background(51);         //redraw background
    
    x += 1;                 //update ball position
    y += 1; 
    
    ellipse(x, y, 50, 50);  //redraw ball
}