Animation: Difference between revisions

Content added Content deleted
m (→‎{{header|Processing Python mode}}: dir is a built-in, renamed variable)
Line 2,088: Line 2,088:


<lang python>txt = "Hello, world! "
<lang python>txt = "Hello, world! "
dir = True
left = True


def draw():
def draw():
Line 2,095: Line 2,095:
text(txt, 10, height / 2)
text(txt, 10, height / 2)
if frameCount % 10 == 0:
if frameCount % 10 == 0:
if (dir):
if (left):
txt = rotate(txt, 1)
txt = rotate(txt, 1)
else:
else:
Line 2,102: Line 2,102:


def mouseReleased():
def mouseReleased():
global dir
global left
dir = not dir
left = not left


def rotate(text, startIdx):
def rotate(text, startIdx):