processing的Python模式代码:流星

0 Comments

Python流星代码meteor

Python流星代码meteor
这是一个动画,在processing的IDE编程,用Python模式,运行后, 流星从左到右划过星空……


x = 0
y = 0
dx = 1
def setup():
    size(600,600)
    background(0)
    noStroke()
    
def draw():
    global dx
    
    dx = dx + 1
    background(0)
    for i in range(256):
       fill(i)
       x = i + dx
       circle(x,100,10)
       i = i + 1
    if x-256 >= width:dx = -256

标签:

发表评论