Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/Animation/Processing/animation.processing
Normal file
26
Task/Animation/Processing/animation.processing
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
String txt = "Hello, world! ";
|
||||
boolean dir = true;
|
||||
|
||||
void draw(){
|
||||
background(128);
|
||||
text(txt, 10, height/2);
|
||||
if(frameCount%10==0){
|
||||
if(dir) {
|
||||
txt = rotate(txt, 1);
|
||||
} else {
|
||||
txt = rotate(txt, txt.length()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mouseReleased(){
|
||||
dir = !dir;
|
||||
}
|
||||
|
||||
String rotate(String text, int startIdx) {
|
||||
char[] rotated = new char[text.length()];
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
rotated[i] = text.charAt((i + startIdx) % text.length());
|
||||
}
|
||||
return String.valueOf(rotated);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue