random roterende dingbats.                  terug naar de inleiding                ga naar de random roterende dingbats in fullscreen

 Met de "d" of "D" toets kan je een afbeelding downloaden.

toetsfuncties: 
Met de "r" wordt de  schets gereset
Met de "s"of "S"  toets stopt, en met elke andere toets start de animatie. 

Met de "d" of "D" toets kan je een afbeelding downloaden

De schets maakt gebruik van de class   "Text",  met stroke() en strokeWeight() en fontkeuze in de constructor,  en  de superclass    "Vormen"

 
//argumenten van de constructor: 1) tekst string, 2) lettergrootte, 3) draaipunt,
  //4) x  positie, 5) y positie, 6) hoek, 7) fonts 8) letterkleur
  //9) lijn dikte, 10) lijnkleur
  let vorm0, vorm1, vorm2;
  fontarray = [];
  function setup() {
  createCanvas(windowWidth, windowHeight);
  const x = width/2;
  const y = height/2;
  const n = height/25;
  const ld = n //ld = lijndikte
  fontarray = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T",
               "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s"];
  //constructor         1                       2    3   4,     5, 6,  7
  font0 = new Text(fontarray[int(random(38))], 12*n, 0, x-14*n, y, 40, 1,
     color(random(0, 225), random(0, 200), random(0, 200),250),  //letterkleur
  ld,color(random(0, 100), random(0, 250), random(0, 100),100)); //lijnkleur
 
  font1 = new Text(fontarray[int(random(38))], 14*n, 0, x,      y,  0, 3,
     color(random(0, 225), random(0, 200), random(0, 200),250),  //letterkleur
  ld,color(random(0, 100), random(0, 250), random(0, 100),100)); //lijnkleur
 
  font2 = new Text(fontarray[int(random(38))], 14*n, 0, x+14*n, y,-40, 2,
     color(random(0, 225), random(0, 200), random(0, 200),250),  //letterkleur
  ld,color(random(0, 100), random(0, 250), random(0, 100),100)); //lijnkleur
}
 
function draw() {
  background(230,251,255);
  if (frameCount == 100) {
    font0.text = fontarray[int(random(38))];
    font1.text = fontarray[int(random(38))];
    font2.text = fontarray[int(random(38))];
    font0.c = color(random(0, 200), random(0, 200),random(0, 200),250);
    font1.c = color(random(0, 200), random(0, 10), random(0, 100),250);
    font2.c = color(random(0, 10),  random(0, 200),random(0, 200),250);
    font0.c2 = color(random(0, 200),random(0, 20), random(0, 100),100);
    font1.c2 = color(random(0, 10), random(0, 200),random(0, 100),100);
    font2.c2 = color(random(0, 200),random(0, 200),random(0, 50),100);
    frameCount = 0;
  }
     font0.display();
     font1.display();
     font2.display();
  if (key == 's' || key == 'S') {
 
   }
     else
   {
     font0. dpRotRe(font0);
     font1. dpRotLi(font1);
     font2. dpRotRe(font2);
  }
}
 
function windowResized() {
  resizeCanvas(windowWidth, windowHeight);
}
 
 function keyPressed() {
  if (key == 'd' || key == 'D') {
   save('letters.png');
    }
 
  if (key == "r") {
      setup();
  }
}