Anonymous user
Animation: Difference between revisions
→{{header|Processing Python mode}}: add sketch 2020-03 by Alexandre Villares
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
(→{{header|Processing Python mode}}: add sketch 2020-03 by Alexandre Villares) |
||
Line 1,994:
return String.valueOf(rotated);
}</lang>
=={{header|Processing Python mode}}==
When the user clicks on the (windowed) text, it should reverse its direction.
<lang python>txt = "Hello, world! "
dir = True
def draw():
global txt
background(128)
text(txt, 10, height / 2)
if frameCount % 10 == 0:
if (dir):
txt = rotate(txt, 1)
else:
txt = rotate(txt, -1)
println(txt)
def mouseReleased():
global dir
dir = not dir
def rotate(text, startIdx):
rotated = text[startIdx:] + text[:startIdx]
return rotated
</lang>
=={{header|Prolog}}==
|