Hi,
I asked a question about my code before, but now I've come across another problem where the brushstroke designs (images) I specified for each letter of the alphabet, they only show once. For example when it sees a "p" in "apple" it only does the first "p" rather than both "p"'s I'm not sure how I would go about it. How would I make it repeat specific letters when needed to? Here's my code:
If someone could help me out with this or point me in the right direction. I'd really appreciate it! Thanks!
I asked a question about my code before, but now I've come across another problem where the brushstroke designs (images) I specified for each letter of the alphabet, they only show once. For example when it sees a "p" in "apple" it only does the first "p" rather than both "p"'s I'm not sure how I would go about it. How would I make it repeat specific letters when needed to? Here's my code:
- void tweet2design() {
//background(233,240,242);
//text(strTweets[j], textX+175,515, 650,100);
/*if(strTweets.length >= textX) {
textY = textY + 50;
}*/ //loop();
char[][] target;
target = new char[strTweets.length][];
for(int i = 0; i < strTweets.length; i++) {
target[i] = strTweets[i].toCharArray();
char c = strTweets[i].charAt(i);
if(j < strTweets.length) {
newMills = millis();
if(newMills > oldMills + 9000) {
fill(53,alphaValue);
background(255);
textAlign(CENTER);
text(strTweets[j], textX + 175,518, 650,100);
alphaValue -=a;
if(alphaValue < 0 || alphaValue > 255) {
a *= -1;
}
//println("first display_time " + counter);
oldMills = newMills;
j++;
if(millis() - lastTime >= DISPLAY_TIME) {
counter = ++counter % images.length;
lastTime = millis();
}
if(alphaImage > 0) { alphaImage -= 1;
}
if(millis() - lastTimeImg >= DISPLAY_TIME) {
tint(255, tintTime()%150);
lastTimeImg = millis();
}
alphaImage -= b;
/*switch(c){
case '~': case '!': case '@': case '#': case '$': case '%': case '^': case '&':
case '*': case '(': case ')': case '_': case '+': case '`': case '9': case '-':
case '=': case '{': case '}': case '|': case ':': case '"': case '<': case '>':
case '?': case '[': case ']': case ';': case ',': case '.': case '/': case '0':
case ' ':
case 'a':
case 'A':
image(images[0],random(200,824),random(125,375));
case 'b':
case 'B':
image(images[1],random(200,824),random(125,375));
case 'c':
case 'C':
image(images[2],random(200,824),random(125,375));
case '1':
case 'd':
case 'D':
image(images[3],random(200,824),random(125,375));
case 'e':
case 'E':
image(images[4],random(200,824),random(125,375));
case 'f':
case 'F':
image(images[5],random(200,824),random(125,375));
case '2':
case 'g':
case 'G':
image(images[6],random(200,824),random(125,375));
case 'h':
case 'H':
image(images[7],random(200,824),random(125,375));
case 'i':
case 'I':
image(images[8],random(200,824),random(125,375));
case '3':
case 'j':
case 'J':
image(images[9],random(200,824),random(125,375));
case 'k':
case 'K':
image(images[10],random(200,824),random(125,375));
case 'l':
case 'L':
image(images[11],random(200,824),random(125,375));
case '4':
case 'm':
case 'M':
image(images[12],random(200,824),random(125,375));
case 'n':
case 'N':
image(images[13],random(200,824),random(125,375));
case 'o':
case 'O':
image(images[14],random(200,824),random(125,375));
case '5':
case 'p':
case 'P':
image(images[15],random(200,824),random(125,375));
case 'q':
case 'Q':
image(images[16],random(200,824),random(125,375));
case 'r':
case 'R':
image(images[17],random(200,824),random(125,375));
case '6':
case 's':
case 'S':
image(images[18],random(200,824),random(125,375));
case 't':
case 'T':
image(images[19],random(200,824),random(125,375));
case 'u':
case 'U':
image(images[20],random(200,824),random(125,375));
case '7':
case 'v':
case 'V':
image(images[21],random(200,824),random(125,375));
case 'w':
case 'W':
image(images[22],random(200,824),random(125,375));
case 'x':
case 'X':
image(images[23],random(200,824),random(125,375));
case '8':
case 'y':
case 'Y':
image(images[24],random(200,824),random(125,375));
case 'z':
case 'Z':
image(images[25],random(200,824),random(125,375));
}
break;*/
}
else {
fill(53,alphaValue);
background(255);
textAlign(CENTER);
text(strTweets[j], textX + 175,518, 650,100);
alphaValue +=a;
if(alphaValue < 0 || alphaValue > 255) {
a *= -1;
}
if(alphaImage > 0) { alphaImage -= 1;
}
tint(255, tintTime()%150);
alphaImage -= b;
switch(c){
case '~': case '!': case '@': case '#': case '$': case '%': case '^': case '&':
case '*': case '(': case ')': case '_': case '+': case '`': case '9': case '-':
case '=': case '{': case '}': case '|': case ':': case '"': case '<': case '>':
case '?': case '[': case ']': case ';': case ',': case '.': case '/': case '0':
case ' ':
case 'a':
case 'A':
image(images[0],random(200,824),random(125,375));
case 'b':
case 'B':
image(images[1],random(200,824),random(125,375));
case 'c':
case 'C':
image(images[2],random(200,824),random(125,375));
case '1':
case 'd':
case 'D':
image(images[3],random(200,824),random(125,375));
case 'e':
case 'E':
image(images[4],random(200,824),random(125,375));
case 'f':
case 'F':
image(images[5],random(200,824),random(125,375));
case '2':
case 'g':
case 'G':
image(images[6],random(200,824),random(125,375));
case 'h':
case 'H':
image(images[7],random(200,824),random(125,375));
case 'i':
case 'I':
image(images[8],random(200,824),random(125,375));
case '3':
case 'j':
case 'J':
image(images[9],random(200,824),random(125,375));
case 'k':
case 'K':
image(images[10],random(200,824),random(125,375));
case 'l':
case 'L':
image(images[11],random(200,824),random(125,375));
case '4':
case 'm':
case 'M':
image(images[12],random(200,824),random(125,375));
case 'n':
case 'N':
image(images[13],random(200,824),random(125,375));
case 'o':
case 'O':
image(images[14],random(200,824),random(125,375));
case '5':
case 'p':
case 'P':
image(images[15],random(200,824),random(125,375));
case 'q':
case 'Q':
image(images[16],random(200,824),random(125,375));
case 'r':
case 'R':
image(images[17],random(200,824),random(125,375));
case '6':
case 's':
case 'S':
image(images[18],random(200,824),random(125,375));
case 't':
case 'T':
image(images[19],random(200,824),random(125,375));
case 'u':
case 'U':
image(images[20],random(200,824),random(125,375));
case '7':
case 'v':
case 'V':
image(images[21],random(200,824),random(125,375));
case 'w':
case 'W':
image(images[22],random(200,824),random(125,375));
case 'x':
case 'X':
image(images[23],random(200,824),random(125,375));
case '8':
case 'y':
case 'Y':
image(images[24],random(200,824),random(125,375));
case 'z':
case 'Z':
image(images[25],random(200,824),random(125,375));
}
break;
}
}
}
}
If someone could help me out with this or point me in the right direction. I'd really appreciate it! Thanks!
1