|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
I am writing processing with python mode these days.
When I run my project as this:
----------------------------------------------------------------------------------------------------
particles = []
def setup():
size(1024,700)
noStroke()
for i in range(1000):
x = random(0,width)
y = random(0,height)
v_mag = random(1.0,2.0)
v_angle = random(-2*PI,2*PI)
particle = [x,y,v_mag,v_angle]
particles.append(particle)
def draw():
fill(0,10)
rect(0,0,width,height)
fill(255)
for particle in particles:
noiseValue = noise(0.001*particle[0],10+0.001*particle[1],frameCount*0.005)
particle[3] = map(noiseValue,0,1,-2*PI,2*PI)
vx = particle[2]*cos(particle[3])
vy = particle[2]*sin(particle[3])
particle[0] = particle[0] + vx
particle[1] = particle[1] + vy
if particle[0]>width or particle[1]>height:
particle[0] = random(0,width)
particle[1] = random(0,height)
circle(particle[0],particle[1],2)
------------------------------------------------------------------------------------------------------
There is only a particle,not a lot.
but I used 'for i in range(1000):',why does it happened?
Friends who have studied processing, please help me!
'range' needs two values
Sorry,I am not good at speaking English
|
|