Hi
I wrote this small exercise for my students (to eventually create MD simulation).
I found it strange that the last ball at the last second does not align with the others, although it's position is seem to be correct (when printed it looks right)
I noticed that even if I try to update one of the ball's position outside the loops (at the end of the code) - the value changes but the animation don't.
whould love to get help..
The code:
from visual import *
table = box(size=(11,11,0))
x=[]
i=-5
while i <= 5:
ball = sphere(pos = (i,-5,0) ,radius = 0.4, color=color.red)
x.append(ball)
i=i+1
t=0
while t < 2:
i=0
while i<=10:
rate(10)
x[i].pos.y = x[i].pos.y+1.0
print(i,x[i].pos.y)
i = i + 1
t=t+1