-
... (n); //world,loc,vel,acc,mass,size boxes= {Red3DBox()}.dup(n); //--loop w.draw{ Pen.strokeColor= Color.white; Pen.fillColor= Color.green(1, 0.25); world.objects.do{|o, i| thetas[i]= thetas[i]+speeds[i]; boxes[i].rotation= RedVector3D[thetas ...
-
... theta]; box.update; //--render box.render(1, 100); //1= exaggerate, 2= standard Pen.translate(width*0.5, height*0.5); Pen.strokeColor= Color.white; box.drawOutlines; Pen.fillColor= Color.white; box.draw; }; w.play; CmdPeriod.doOnce({w.close ...
-
... ld.neighbours(o).sum{|oo| oo.state} }; world.objects.do{|o, i| if(o.state==1, { Pen.addRect(Rect(o.loc[0]*wx, o.loc[1]*hy, wx, hy)); }); if(counts[i]==3, { o.state= 1; }, { if(counts[i]!=2, { o.state= 0; }); }); }; Pen.smoothing_(false); Pe ...
-
... rcube.update; //--render hypercube.render(2, 500); //1= exaggerate, 2= standard Pen.translate(width*0.5, height*0.5); Pen.fillColor= Color.white; hypercube.draw; Pen.strokeColor= Color.white; hypercube.drawOutlines; }; w.play; CmdPeriod.doO ...
-
... planes= {|i| Red3DPlane(RedVector3D[0, i+1/n-0.5, 0])}.dup(n); //--loop w.draw{ Pen.strokeColor= Color.grey(1, 0.5); Pen.translate(0, -50); world.objects.do{|o, i| thetas[i]= thetas[i]+speeds[i]; planes[i].rotation= RedVector3D[thetas[i], t ...
-
... Wander2D; o.addForceArrive(world.objects[0].loc); //--plot target for testing //Pen.strokeColor= Color.red; //Pen.strokeOval(Rect.aboutRedVector2D(trg, o.wradius)); }, { world.objects[0].loc= w.mouse; }); //o.addForce(world.gravity); //no g ...
-
... nge_(0.9) .state_((\synth: Synth(\beating))) }.dup(n); s.sync; //--loop w.draw{ Pen.width= 1; 4.do{|i| Pen.fillColor= Color.grey(0.4, i+1/(4)); Pen.fillOval(Rect.aboutRedVector2D(w.mouse, (4-i)/3*50)); }; world.objects.do{|o, i| //iterate a ...
-
... |o| lookup.at(o).sum{|oo| oo.state} }; world.objects.do{|o, i| if(o.state==1, { Pen.addRect(Rect(o.loc[0]*wx, o.loc[1]*hy, wx-1, hy-1)); }); if(counts[i]==3, { o.state= 1; }, { if(counts[i]!=2, { o.state= 0; }); }); }; Pen.smoothing_(false) ...
-
... 2pi.rand) .phase2_(2pi.rand) .amp_(0.85) }; ~showLinks= false; //--loop w.draw{ Pen.strokeColor= Color.grey(0.5, 0.5); world.objects.do{|o, i| o.couple(world.objects.wrapAt(i-1), world.objects.wrapAt(i+1)); }; world.objects.do{|o| o.update; ...
-
... }}.do{|s| physics.removeSpring(s)}; physics.removeParticle(p); }; physics.tick; Pen.width= 0.25; physics.springs.do{|s| Pen.strokeColor= Color.grey(1-(s.currentLength/75), 0.2); Pen.addOval(Rect.newSides(s.getOneEnd.position.x, s.getOneEnd. ...