Typography loop problem
in
Programming Questions
•
1 month ago
I'm trying to make a sketch that repeats the text entered into bgText across the background completely, the word REDACTED is then written over the top. After making the simple version, I tried to make a set of iterations to automate the process but have met with limited success. Can you help me?
Thanks
- //Leave a space on both ends of the string
- String bgText=" A ";
- size(800, 600);
- background(100, 100, 100);
- fill(255);
- PFont consolas = loadFont("Consolas-24.vlw");
- textFont(consolas);
- textSize(20);
- int a = 0;
- int b=0;
- int c=100;
- int d=120;
- int e=0;
- float f=textWidth(bgText);
- int g=0;
- int h=1;
- // The code commented out creates the desired effect, un-comment and remove lines 54-63
- /*while (a < 640 & b < 820){
- text(bgText, b, a);
- text(bgText, b+f, a);
- text(bgText, b+(f*2), a);
- text(bgText, b+(f*3), a);
- text(bgText, b+(f*4), a);
- text(bgText, b+(f*5), a);
- text(bgText, b+(f*6), a);
- text(bgText, b+(f*7), a);
- text(bgText, b+(f*8), a);
- text(bgText, b+(f*9), a);
- text(bgText, b+(f*10), a);
- text(bgText, b+(f*11), a);
- text(bgText, b+(f*12), a);
- text(bgText, b+(f*13), a);
- text(bgText, b+(f*14), a);
- text(bgText, b+(f*15), a);
- text(bgText, b+(f*16), a);
- text(bgText, b+(f*17), a);
- text(bgText, b+(f*18), a);
- text(bgText, b+(f*19), a);
- text(bgText, b+(f*20), a);
- text(bgText, b+(f*21), a);
- text(bgText, b+(f*22), a);
- text(bgText, b+(f*23), a);
- text(bgText, b+(f*24), a);
- text(bgText, b+(f*25), a);
- a=a+20;
- }
- */
- for (a = 0; a < 640; a = a + 20) {
- text(bgText, b, a);
- }
- for (int x = 0; x < 640; x = x + 20 ) {
- text(bgText, b+(f*h), x);
- if(x>=640){
- h = h + 1;
- x = 0;
- }
- }
- textSize(150);
- while (d < 700) {
- fill(e);
- text("REDACTED", c, d);
- d=d+150;
- e=e+30;
- }
1