Created
January 2, 2010 11:46
-
-
Save akisute/267472 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PFont font; | |
String message; | |
void setup() { | |
size(300, 700); | |
noLoop(); | |
font = createFont("HiraMinProN-W6", 36, true); | |
message = "あけまして\nおめでとう\nございます\n今年もよろしくお願いします"; | |
} | |
void draw() { | |
background(#e6eae3); | |
fill(#595857); | |
textFont(font); | |
text(createVerticalMessage(message), 15, 50); | |
} | |
String createVerticalMessage(String s) { | |
String result = ""; | |
String[] messages = message.split("\n"); | |
int maxLengthOfMessage = 0; | |
for (int i=0; i<messages.length; i++) { | |
String m = messages[i]; | |
if (m.length() > maxLengthOfMessage) { | |
maxLengthOfMessage = m.length(); | |
} | |
} | |
for (int y=0; y<maxLengthOfMessage; y++) { | |
ArrayList chars = new ArrayList(); | |
for (int x=0; x<messages.length; x++) { | |
String m = messages[x]; | |
println(m); | |
String c = (y >= m.length()) ? " " : String.valueOf(m.charAt(y)); | |
chars.add(c); | |
} | |
for (int i=chars.size()-1; i>=0; i--) { | |
result += chars.get(i); | |
} | |
result += "\n"; | |
} | |
println(result); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment