xxxxxxxxxx
566
let sped = 1;
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
colorMode(HSB, 360, 100, 100);
angleMode(DEGREES);
hive = 0;
swarm = 0;
bee1 = 0;
bee2 = 0;
bee3 = 0;
bee4 = 0;
}
function draw() {
background(0);
orbitControl();
ambientLight(0, 0, 100);
pointLight(0, 0, 50, -width, -height, 10);
//the hive
{
push();
rotateY(hive);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
translate(0, 0, -((width / 32) * 12));
rotateX(90);
cone((width / 64) * 10, width / 8);
rotateX(-90);
torus((width / 64) * 10, width / 16);
translate(0, 0, (width / 32) * 3);
torus((width / 64) * 15, (width / 32) * 2);
translate(0, 0, (width / 32) * 3);
torus((width / 64) * 18, (width / 32) * 2);
translate(0, 0, (width / 32) * 3);
torus((width / 32) * 10, (width / 32) * 2);
translate(0, 0, (width / 32) * 3);
torus((width / 64) * 21, (width / 32) * 2);
translate(0, 0, (width / 32) * 3);
torus((width / 32) * 10, (width / 32) * 2);
translate(0, 0, (width / 32) * 3);
torus((width / 64) * 18, (width / 32) * 2);
translate(0, 0, (width / 32) * 3);
torus((width / 64) * 15, (width / 32) * 2);
translate(0, 0, (width / 32) * 3);
torus((width / 64) * 10, width / 16);
rotateX(270);
cone((width / 64) * 10, width / 8);
rotateX(-270);
rotateZ(90);
translate(0, (width / 16) * 5, -width / 2);
fill(0, 0, 0);
cylinder((width / 64) * 3, width / 8);
pop();
}
//THE BEEES
{
push();
rotateY(swarm);
//swarm1
{
push();
translate(height, (height / 4) * 3, height);
rotateY(bee1);
//bee1
{
push();
translate(width / 2, 0);
rotateX(bee1);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
ellipsoid(width / 16, height / 8, width / 16);
rotateX(90);
fill(0, 0, 0);
translate(0, 0, -width / 32);
torus(width / 64, height / 16);
translate(0, 0, width / 16);
torus(width / 64, height / 16);
rotateZ(270);
translate(-width / 128, 0, (width / 128) * 7);
cylinder(width / 128, height / 16);
translate(width / 128, 0, (-width / 128) * 7);
rotateZ(-270);
ambientMaterial(50, 70, 100);
translate(0, 0, -width / 8);
rotateX(270);
cone(width / 32, height / 16);
pop();
}
//bee2
{
push();
rotateX(bee2);
translate(-width / 2, 0);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
ellipsoid(width / 16, height / 8, width / 16);
rotateX(90);
fill(0, 0, 0);
translate(0, 0, -width / 32);
torus(width / 64, height / 16);
translate(0, 0, width / 16);
torus(width / 64, height / 16);
rotateZ(270);
translate(-width / 128, 0, (width / 128) * 7);
cylinder(width / 128, height / 16);
translate(width / 128, 0, (-width / 128) * 7);
rotateZ(-270);
ambientMaterial(50, 70, 100);
translate(0, 0, -width / 8);
rotateX(270);
cone(width / 32, height / 16);
pop();
}
//bee3
{
push();
rotateX(bee3);
translate(0, 0, width / 2);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
ellipsoid(width / 16, height / 8, width / 16);
rotateX(90);
fill(0, 0, 0);
translate(0, 0, -width / 32);
torus(width / 64, height / 16);
translate(0, 0, width / 16);
torus(width / 64, height / 16);
rotateZ(270);
translate(-width / 128, 0, (width / 128) * 7);
cylinder(width / 128, height / 16);
translate(width / 128, 0, (-width / 128) * 7);
rotateZ(-270);
ambientMaterial(50, 70, 100);
translate(0, 0, -width / 8);
rotateX(270);
cone(width / 32, height / 16);
pop();
}
//bee4
{
push();
rotateZ(bee4);
translate(0, 0, -width / 2);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
ellipsoid(width / 16, height / 8, width / 16);
rotateX(90);
fill(0, 0, 0);
translate(0, 0, -width / 32);
torus(width / 64, height / 16);
translate(0, 0, width / 16);
torus(width / 64, height / 16);
rotateZ(270);
translate(-width / 128, 0, (width / 128) * 7);
cylinder(width / 128, height / 16);
translate(width / 128, 0, (-width / 128) * 7);
rotateZ(-270);
ambientMaterial(50, 70, 100);
translate(0, 0, -width / 8);
rotateX(270);
cone(width / 32, height / 16);
pop();
}
pop();
}
//swarm2
{
push();
translate(-height, height / 2, -height);
rotateY(bee2);
//bee1
{
push();
rotateZ(bee4);
translate(width / 2, 0);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
ellipsoid(width / 16, height / 8, width / 16);
rotateX(90);
fill(0, 0, 0);
translate(0, 0, -width / 32);
torus(width / 64, height / 16);
translate(0, 0, width / 16);
torus(width / 64, height / 16);
rotateZ(270);
translate(-width / 128, 0, (width / 128) * 7);
cylinder(width / 128, height / 16);
translate(width / 128, 0, (-width / 128) * 7);
rotateZ(-270);
ambientMaterial(50, 70, 100);
translate(0, 0, -width / 8);
rotateX(270);
cone(width / 32, height / 16);
pop();
}
//bee2
{
push();
rotateX(bee2);
translate(-width / 2, 0);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
ellipsoid(width / 16, height / 8, width / 16);
rotateX(90);
fill(0, 0, 0);
translate(0, 0, -width / 32);
torus(width / 64, height / 16);
translate(0, 0, width / 16);
torus(width / 64, height / 16);
rotateZ(270);
translate(-width / 128, 0, (width / 128) * 7);
cylinder(width / 128, height / 16);
translate(width / 128, 0, (-width / 128) * 7);
rotateZ(-270);
ambientMaterial(50, 70, 100);
translate(0, 0, -width / 8);
rotateX(270);
cone(width / 32, height / 16);
pop();
}
//bee3
{
push();
rotateY(bee3);
translate(0, 0, width / 2);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
ellipsoid(width / 16, height / 8, width / 16);
rotateX(90);
fill(0, 0, 0);
translate(0, 0, -width / 32);
torus(width / 64, height / 16);
translate(0, 0, width / 16);
torus(width / 64, height / 16);
rotateZ(270);
translate(-width / 128, 0, (width / 128) * 7);
cylinder(width / 128, height / 16);
translate(width / 128, 0, (-width / 128) * 7);
rotateZ(-270);
ambientMaterial(50, 70, 100);
translate(0, 0, -width / 8);
rotateX(270);
cone(width / 32, height / 16);
pop();
}
//bee4
{
push();
rotateY(bee3);
translate(0, 0, -width / 2);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
ellipsoid(width / 16, height / 8, width / 16);
rotateX(90);
fill(0, 0, 0);
translate(0, 0, -width / 32);
torus(width / 64, height / 16);
translate(0, 0, width / 16);
torus(width / 64, height / 16);
rotateZ(270);
translate(-width / 128, 0, (width / 128) * 7);
cylinder(width / 128, height / 16);
translate(width / 128, 0, (-width / 128) * 7);
rotateZ(-270);
ambientMaterial(50, 70, 100);
translate(0, 0, -width / 8);
rotateX(270);
cone(width / 32, height / 16);
pop();
}
pop();
}
//swarm3
{
push();
translate(-height, -height / 2, height);
rotateZ(bee3);
//bee1
{
rotateX(bee1);
push();
translate(width / 2, 0);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
ellipsoid(width / 16, height / 8, width / 16);
rotateX(90);
fill(0, 0, 0);
translate(0, 0, -width / 32);
torus(width / 64, height / 16);
translate(0, 0, width / 16);
torus(width / 64, height / 16);
rotateZ(270);
translate(-width / 128, 0, (width / 128) * 7);
cylinder(width / 128, height / 16);
translate(width / 128, 0, (-width / 128) * 7);
rotateZ(-270);
ambientMaterial(50, 70, 100);
translate(0, 0, -width / 8);
rotateX(270);
cone(width / 32, height / 16);
pop();
}
//bee2
{
push();
rotateY(bee2);
translate(-width / 2, 0);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
ellipsoid(width / 16, height / 8, width / 16);
rotateX(90);
fill(0, 0, 0);
translate(0, 0, -width / 32);
torus(width / 64, height / 16);
translate(0, 0, width / 16);
torus(width / 64, height / 16);
rotateZ(270);
translate(-width / 128, 0, (width / 128) * 7);
cylinder(width / 128, height / 16);
translate(width / 128, 0, (-width / 128) * 7);
rotateZ(-270);
ambientMaterial(50, 70, 100);
translate(0, 0, -width / 8);
rotateX(270);
cone(width / 32, height / 16);
pop();
}
//bee3
{
push();
rotateZ(bee3);
translate(0, 0, width / 2);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
ellipsoid(width / 16, height / 8, width / 16);
rotateX(90);
fill(0, 0, 0);
translate(0, 0, -width / 32);
torus(width / 64, height / 16);
translate(0, 0, width / 16);
torus(width / 64, height / 16);
rotateZ(270);
translate(-width / 128, 0, (width / 128) * 7);
cylinder(width / 128, height / 16);
translate(width / 128, 0, (-width / 128) * 7);
rotateZ(-270);
ambientMaterial(50, 70, 100);
translate(0, 0, -width / 8);
rotateX(270);
cone(width / 32, height / 16);
pop();
}
//bee4
{
push();
rotateX(bee4);
translate(0, 0, -width / 2);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
ellipsoid(width / 16, height / 8, width / 16);
rotateX(90);
fill(0, 0, 0);
translate(0, 0, -width / 32);
torus(width / 64, height / 16);
translate(0, 0, width / 16);
torus(width / 64, height / 16);
rotateZ(270);
translate(-width / 128, 0, (width / 128) * 7);
cylinder(width / 128, height / 16);
translate(width / 128, 0, (-width / 128) * 7);
rotateZ(-270);
ambientMaterial(50, 70, 100);
translate(0, 0, -width / 8);
rotateX(270);
cone(width / 32, height / 16);
pop();
}
pop();
}
//swarm4
{
push();
translate(height, -height / 2, -height);
rotateX(bee4);
//bee1
{
push();
rotateZ(bee1);
translate(width / 2, 0);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
ellipsoid(width / 16, height / 8, width / 16);
rotateX(90);
fill(0, 0, 0);
translate(0, 0, -width / 32);
torus(width / 64, height / 16);
translate(0, 0, width / 16);
torus(width / 64, height / 16);
rotateZ(270);
translate(-width / 128, 0, (width / 128) * 7);
cylinder(width / 128, height / 16);
translate(width / 128, 0, (-width / 128) * 7);
rotateZ(-270);
ambientMaterial(50, 70, 100);
translate(0, 0, -width / 8);
rotateX(270);
cone(width / 32, height / 16);
pop();
}
//bee2
{
push();
rotateX(bee2);
translate(-width / 2, 0);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
ellipsoid(width / 16, height / 8, width / 16);
rotateX(90);
fill(0, 0, 0);
translate(0, 0, -width / 32);
torus(width / 64, height / 16);
translate(0, 0, width / 16);
torus(width / 64, height / 16);
rotateZ(270);
translate(-width / 128, 0, (width / 128) * 7);
cylinder(width / 128, height / 16);
translate(width / 128, 0, (-width / 128) * 7);
rotateZ(-270);
ambientMaterial(50, 70, 100);
translate(0, 0, -width / 8);
rotateX(270);
cone(width / 32, height / 16);
pop();
}
//bee3
{
push();
rotateY(bee3);
translate(0, 0, width / 2);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
ellipsoid(width / 16, height / 8, width / 16);
rotateX(90);
fill(0, 0, 0);
translate(0, 0, -width / 32);
torus(width / 64, height / 16);
translate(0, 0, width / 16);
torus(width / 64, height / 16);
rotateZ(270);
translate(-width / 128, 0, (width / 128) * 7);
cylinder(width / 128, height / 16);
translate(width / 128, 0, (-width / 128) * 7);
rotateZ(-270);
ambientMaterial(50, 70, 100);
translate(0, 0, -width / 8);
rotateX(270);
cone(width / 32, height / 16);
pop();
}
//bee4
{
push();
rotateX(bee4);
translate(0, 0, -width / 2);
rotateX(90);
rotateZ(90);
ambientMaterial(50, 70, 100);
noStroke();
ellipsoid(width / 16, height / 8, width / 16);
rotateX(90);
fill(0, 0, 0);
translate(0, 0, -width / 32);
torus(width / 64, height / 16);
translate(0, 0, width / 16);
torus(width / 64, height / 16);
rotateZ(270);
translate(-width / 128, 0, (width / 128) * 7);
cylinder(width / 128, height / 16);
translate(width / 128, 0, (-width / 128) * 7);
rotateZ(-270);
ambientMaterial(50, 70, 100);
translate(0, 0, -width / 8);
rotateX(270);
cone(width / 32, height / 16);
pop();
}
pop();
}
pop();
}
//the turny part
{
hive = hive + sped;
swarm = swarm + 2 * sped;
bee1 = bee1 + 3 * sped;
bee2 = bee2 + sped;
bee3 = bee3 + 6 * sped;
bee4 = bee4 + 2 * sped;
}
}
function keyTyped() {
if (key === "1") {
sped = 1;
} else if (key === "2") {
sped = 2;
} else if (key === "3") {
sped = 3;
} else if (key === "4") {
sped = 4;
} else if (key === "0") {
sped = 0;
}
}