xxxxxxxxxx
34
// Learning Objectives
// Introduction to the WebEditor
// First steps with JavaScript and p5
// Function calls
// Shapes, colour
// Variables
let positionX = 150;
function setup() {
createCanvas(300, 300);
background(19, 211, 214);
}
function draw() {
// mouseX and mouseY are some of the variables
// provided by p5
// circle(mouseX, 150, 30);
stroke(0);
fill(250, 250, 0);
circle(positionX, 150, 20);
positionX = positionX + random(-5, 5);
}
// CHALLENGES
// Make the circle also move randomly on the y axis
// Make the circle not leave a trace
// Make the circle leave a faint trace
// Mover the circle with your mouse
// Play with the drawing