xxxxxxxxxx
111
//chrismas tree, snowing
let snow;
function preload() {
snow = loadModel("snow.obj");
}
//chrismas=loadModel('chrismas.obj')
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
}
function draw() {
background(220);
// trunk()
// spiral(55,windowWidth/2)
snowing();
}
function snowing() {
for (countSnow = -width; countSnow < width; countSnow = countSnow + 50) {
push(); translate(random(-width,width),y, 0);
rotateY(frameCount * 0.01);
scale(0.5);
stroke(0, 20);
model(snow); pop();
y=y+0.1
if(y>height){y=-height}
}
}
// function spiral(x,y)
// {push();
// translate(0, x, 0);
// fill(0, 100, 0)
// rotateX(frameCount * 0.01);
// rotate(HALF_PI);
// cylinder(20, y);
// pop();}
// function trunk(){
// push();
// translate(0, 200, 0);
// rotateY(frameCount * 0.01);
// fill(139, 69, 19) //chatGPT
// cylinder(20, 250);
// pop();}
// push();
// translate(0, 55, 0);
// fill(0, 100, 0)
// rotateX(frameCount * 0.01);
// rotate(HALF_PI);
// cylinder(20, windowWidth/2);
// pop();
// push();
// translate(0, 15, 0);
// fill(0, 100, 0)
// rotateX(frameCount * 0.01);
// rotate(HALF_PI);
// cylinder(20, windowWidth/2.5);
// pop();
// push();
// translate(0, -20, 0);
// fill(0, 100, 0)
// rotateX(frameCount * 0.01);
// rotate(HALF_PI);
// cylinder(20, windowWidth/3);
// pop();
// push();
// translate(0, -60, 0);
// fill(0, 100, 0)
// rotateX(frameCount * 0.01);
// rotate(HALF_PI);
// cylinder(20, windowWidth/3.5);
// pop();
}
function mousePressed() {
if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
let fs = fullscreen();
fullscreen(!fs);
}
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}