How To Make a Judicious Leo In P5
This is the project which i have not shared with my YouTube Community so let's start and see how to build it..
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
Type the following code:
const radius = 200;
function setup() {
createCanvas(710, 400 , WEBGL);
noStroke();
fill(200);
}
function draw() {
background(0);
const dirY = (mouseY / height-0.5)*4;
const dirX = (mouseX / width-0.5)*4;
directionalLight(204, 204, 204, dirY, dirX , 1);
translate(-1.5 * radius, 0, 0);
sphere(radius);
translate(3*radius, 0, 0);
sphere (radius);
}
Now Your Judicious Leo Is Ready
0 Comments