22 lines
417 B
Plaintext
22 lines
417 B
Plaintext
txt = "Hello, world! "
|
|
left = True
|
|
|
|
def draw():
|
|
global txt
|
|
background(128)
|
|
text(txt, 10, height / 2)
|
|
if frameCount % 10 == 0:
|
|
if (left):
|
|
txt = rotate(txt, 1)
|
|
else:
|
|
txt = rotate(txt, -1)
|
|
println(txt)
|
|
|
|
def mouseReleased():
|
|
global left
|
|
left = not left
|
|
|
|
def rotate(text, startIdx):
|
|
rotated = text[startIdx:] + text[:startIdx]
|
|
return rotated
|