xxxxxxxxxx
71
var rot = 0;
var light = 0;
var otherLight = 0;
var anotherLight = 0;
var font;
//var snowy;
function setup() {
//createCanvas(400,400);
//snowy = loadImage("winter-landscape-with-falling-snow-snowy-background_209425-650.jpg");
createCanvas(400, 400, WEBGL);
font = loadFont("Poppins-Regular.ttf");
textFont(font);
textSize(40);
textAlign(CENTER);
}
function draw() {
background(0);
noStroke();
fill(200,200,200);
lights();
translate(0,60);
pointLight(light,otherLight,anotherLight,400,0,200);
pointLight(anotherLight,light,otherLight,-400,0,200);
//translate(mouseX - 200, mouseY - 200, 0)
//rotateX(mouseY/-100);
//if (mouseIsPressed) {
camera(7*mouseX,mouseY-600,400);
//rotateY(mouseX/-100);
//rotateX(mouseY/-100);
//rotateZ(mouseY/-100);
//}
translate(0,200);
text("Press Enter for different colors", 50,50)
translate(0,-200);
sphere(90);
translate(0,-70);
sphere(70);
translate(0,-70);
sphere(40);
translate(0,50);
translate(-10,-50,40);
sphere(8);
translate(10,50,-40);
translate(15,-50,40);
sphere(8);
translate(-15,50,-40);
translate(90,-10);
rotate(70);
cylinder(10,100);
rotate(-70);
translate(-180,-20);
rotate(40);
cylinder(10,100);
//sphere(200);
//plane(200);
//cylinder(100);
//rot = rot + 0.01;
if(keyIsPressed){
if (keyCode == ENTER) {
light = random(255);
otherLight = random(255);
anotherLight = random(255);
}
}
}
//By default, the box is set to the middle (200,200). To change it you need to translate.