Processing.py中的“动画”运动

I need to animate the movement of some linkages in processing. I use processing.py

我尝试了一个玩具示例,其中在屏幕上移动线段。我的想法是: 1)画线 2)延迟一秒钟 3)擦除屏幕 4)改变行的位置 5)重复。

但是我的代码不起作用。它逐渐增加,但最终仅显示最终的行位置。我从来没有看到中间的步骤。

import math

def setup():
    size(800, 500)
    noLoop()

def draw():

    line(100,100,200,200)
    delay(100)

    x1,y1,x2,y2 = (100,100,200,200)

    for chunk in range(10,100,10):
        print(chunk)
        background(255)
        line(x1,y1,x2,y2)
        delay(1000)
        x2 += chunk

enter image description here