Animation In P5.js
This is the project which i have not shared with my YouTube Community so let's start and see how to build it..This is a VIP Project
1. Open P5.js Editor
STEP 1- Go to google.com and search p5.js and click on the first option.
STEP 2-Inside that option click on Home.
STEP 3-Then Click Start creating with p5 editor.
2. Create a New Project
Code:
let angle = 0.0;
let jitter = 0.0;
function setup() {
createCanvas(720,400);
noStroke();
fill("purple");
rectMode();
}
function draw() {
background("purple");
if (second()%2===0) {
jitter = random(-0.1, 0.1);
angle = angle + jitter;
let c = cos(angle);
translate ( width / 2, height / 2);
rect (0, 0, 180, 180);
fill("red");
}
}
0 Comments