Schets met 8 roterende zeshoeken.                                    terug naar de inleiding  
toets "s" stoppen de rotaties met iedere ander toets starten de rotaties weer.

                                                                       acht roterende zeshoeken in fullscreen

 
schets in p5.js
De schets maakt gebruik van de p5.js classses "Vhoek_n6" en de superclass "Vormen"
 
 
let vorm = []; let zeshoek = true; let ruitjes = false;
function setup() {
 createCanvas(windowWidth, windowHeight);
 buttonR = createButton('reset');
 buttonR.position(20,40);buttonR.style('width','70px');
 buttonR.mouseClicked(buttonRAction);
 button1 = createButton('dp 1');
 button1.position(20,80);button1.style('width','70px');
 button1.mouseClicked(button1Action);
 button2 = createButton('dp 2');
 button2.position(20,120);button2.style('width','70px');
 button2.mouseClicked(button2Action);
 button3 = createButton('dp 3');
 button3.position(20,160);button3.style('width','70px');
 button3.mouseClicked(button3Action);
 button4 = createButton('dp 4');
 button4.position(20,200);button4.style('width','70px');
 button4.mouseClicked(button4Action);
 button5 = createButton('dp 5');
 button5.position(20,240);button5.style('width','70px');
 button5.mouseClicked(button5Action);
 button6 = createButton('dp 6');
 button6.position(20,280);button6.style('width','70px');
 button6.mouseClicked(button6Action);
 button7 = createButton('dp 7');
 button7.position(20,320);button7.style('width','70px');
 button7.mouseClicked(button7Action);
 button8 = createButton('dp 8');
 button8.position(20,360);button8.style('width','70px');
 button8.mouseClicked(button8Action);
 button9 = createButton('dp 9');
 button9.position(20,400);button9.style('width','70px');
 button9.mouseClicked(button9Action);
 
 buttonZ = createButton('zeshoek aan/uit');
 buttonZ.position(20,440);buttonZ.style('width','140px');
 buttonZ.mouseClicked(buttonZAction);
 
 buttonRuit = createButton('ruitjes aan/uit');
 buttonRuit.position(20,480);buttonRuit.style('width','140px');
 buttonRuit.mouseClicked(buttonRuitAction);
 
 buttonD = createButton('downloaden');
 buttonD.position(20,520);buttonD.style('width','140px');
 buttonD.mouseClicked(buttonDAction);
  let x = width/2; let y = height/2; let n = height/10;
  let alfa = 100; let kleur = 0; let sw = n/65; let sc = color(0);
  vorm[0] = new Vhoek_n6(n*2,0, x, y,30,color(255,255,51,alfa),sw,sc);
  vorm[1] = new Vhoek_n6(n,  2, x, y, 0,color(255,51, 52,alfa),sw,sc);
  vorm[2] = new Vhoek_n6(n,  2, x, y, 0,color(255,163,102,alfa),sw,sc);
  vorm[3] = new Vhoek_n6(n*2,2, x, y,-90,color(77,255,77, alfa-50),sw,sc);
  vorm[4] = new Vhoek_n6(n*2,2, x, y, 90,color(255,214,51,alfa-50),sw,sc);
  vorm[5] = new Vhoek_n6(n*2,5, x, y,-90,color(102,255,150,alfa-50),sw,sc);
  vorm[6] = new Vhoek_n6(n*2,5, x, y, 90,color(0,200, 255,alfa-50),sw,sc);
  vorm[7] = new Vhoek_n6(n,  5, x, y,  0,color(51,255,51,alfa),sw,sc);
  vorm[8] = new Vhoek_n6(n,  5, x, y,  0,color(0,200,255,alfa),sw,sc);
  ruitjespap = new Ruitjes(n,x,y);
}
 
function draw() {
  //background('#E6FBFF');
  clear();
  background('rgba(255,255,255, 0)');
  if (zeshoek) {vorm[0].display();}
  if (ruitjes) {ruitjespap.display();for (let i=1; i<9; i++){vorm[i].dpAan();}};
  for (let i = 1; i < 9; i++){vorm[i].display();}
   if (key == 's'|| key == 'S') {  }
   else
 {
  vorm[1].dpRotLi(vorm[1]); vorm[2].dpRotRe(vorm[2]);
  vorm[3].dpRotLi(vorm[3]); vorm[4].dpRotRe(vorm[4]);
  vorm[5].dpRotLi(vorm[5]); vorm[6].dpRotRe(vorm[6]);
  vorm[7].dpRotLi(vorm[7]); vorm[8].dpRotRe(vorm[8]);
  }
}
 
function windowResized() {
 resizeCanvas(windowWidth, windowHeight);
}
function buttonRAction(){setup();}
function button1Action()
  {for (let i = 1; i < 5;i++){vorm[i].d = 2;vorm[i+4].d = 5;}}
function button2Action()
  {for (let i = 1; i < 5;i++){vorm[i].d = 1;vorm[i+4].d = 6;}}
function button3Action()
  {for (let i = 1; i < 5;i++){vorm[i].d = 3;vorm[i+4].d = 4;}}
function button4Action()
  {for (let i = 1; i < 5;i++){vorm[i].d = 7;vorm[i+4].d = 8;}}
function button5Action()
  {for (let i = 1; i < 5;i++){vorm[i].d = 1;vorm[i+4].d = 4;}}
function button6Action()
  {for (let i = 1; i < 5;i++){vorm[i].d = 4;vorm[i+4].d = 6;}}
function button7Action()
  {for (let i = 1; i < 5;i++){vorm[i].d = 7;vorm[i+4].d = 3;}}
function button8Action()
  {for (let i = 1; i < 5;i++){vorm[i].d = 6;vorm[i+4].d = 5;}}
function button9Action()
  {for (let i = 1; i < 5;i++){vorm[i].d = 2;vorm[i+4].d = 6;}}
 
function buttonZAction(){if(zeshoek){zeshoek = false;} else {zeshoek = true;}}
function buttonRuitAction(){if(ruitjes){ruitjes = false;} else {ruitjes = true;}}
function buttonDAction(){save('zeshoeken.png');}