xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL); // size(800,1000,P3D);
noStroke();
colorMode(HSB); // colorMode(HSB,360,100,100);
}
function draw() {
background(0);
push(); // pushMatrix();
translate(width*0.5,height*0.35);
// my_triangle(0,0,500,0);
my_triangle(50 - windowWidth/2, -50 - windowHeight/2, 300, 90);
pop(); // popMatrix();
}
function my_triangle(x, y, side, hue){
push(); // pushMatrix();
translate(x,y);
rotateY(frameCount*0.01);
len = 0.5 * side * cos((1.0/6.0)*PI);
fill(hue,100,100);
triangle(0,-len, -0.5*side,len, 0.5*side,len);
if (side > 4){
my_triangle(0,1.5*len,side*0.5,(hue+30)%360);
my_triangle(-0.5*side, -0.5*len, side*0.5,(hue+30)%360);
my_triangle(0.5*side, -0.5*len, side*0.5,(hue+30)%360);
}
pop() // popMatrix();
}