Mittwoch, 22. Juli 2009

Python 033



Hier nochmal ein anderer, einfacherer Programmcode:

from visual import *
import random

scene.width=900
scene.height=700
scene.center=(22,11,1)

nball = 2
xvar=10000

ball = []
line = []
for x in range(xvar):
ball.append(1)
line.append(1)

# Ball und Linie deklarieren
ball[1] = sphere(pos=(0,0,0), radius=0.0001)
ball[2] = sphere(pos=(0,0,0), radius=0.0001)
line[1] = curve(radius=1, color=color.black)

t = 0

k = 1
l = 6
m = 6
n = 1

faktor = 100
for i in range(1000):
t += 0.01
for i in range(nball):
xa = 2*sin(t)+sin(13*t)
ya = 2*cos(t)+cos(13*t)
ball[1].pos = (xa*faktor,ya*faktor,0)
line[1].append((ball[1].pos), color=color.green)

Keine Kommentare:

 
eXTReMe Tracker