from c4d import * import math import random #strange attractor for Py4D by smart-page.net particles = 10000 tps = [] def create_particles(): for x in xrange(0, particles): p = TParticle(doc) tps.append(p) p.set_life(BaseTime(10000)) def main(): global tp global doc global res frame = doc.get_time().get_frame(doc.get_fps()) _a = 2.24 _b = 0.43 _c = -0.65 _d = -2.43 _e = 1.0 cx = 1 cy = 1 cz = 1 mx = 0 my = 0 mz = 0 if frame==0: tp.free_all_particles() if frame==1: create_particles() for i, myvertice in enumerate(tp.get_particles()): mx = math.sin(_a*cy)-cz*math.cos(_b*cx) my = cz*math.sin(_c*cx)-math.cos(_d*cy) mz = _e*math.sin(cx) cx = mx cy = my cz = mz v = Vector() v.x=mx*50 v.y=my*50 v.z=mz*50 myvertice.set_pos(v)