-
//objects shoot out off each other. with friction and world damping to compensate. ( var width= 300, height= 300, w, wgrav, world, n= 18; //--world w= RedWindow("bounce test", Rect(128, 64, width, height)).front; wgrav= RedVector2D[-0.1, 0. ...
-
... el= obj.vel*0; //stop object }); }); obj.update; world.contain(obj); //--render Pen.fillColor= Color.red; Pen.fillRect(fric); Pen.strokeColor= Color.white; Pen.strokeRect(Rect.aboutRedObject2D(obj)); }; w.play; CmdPeriod.doOnce({w.close}); ...
-
... { o.addForce(o.gravityForce(oo)); }); }; o.update; world.contain(o); //--render Pen.strokeColor= Color.blue; Pen.strokeOval(Rect.aboutRedObject2D(o)); }; world.objects.do{|o, i| bary= bary+(o.loc*o.mass); }; bary= bary/totalMass; Pen.fillCo ...
-
... el= obj.vel*0; //stop object }); }); obj.update; world.contain(obj); //--render Pen.fillColor= Color.green; Pen.fillRect(fric); Pen.strokeColor= Color.white; Pen.strokeRect(Rect.aboutRedObject2D(obj)); }; w.play; CmdPeriod.doOnce({w.close}) ...
-
... e }.dup(n); synths= {Synth("fm3Dtest", [\amp, 0.5/n])}.dup(n); //--loop w.draw{ Pen.strokeColor= Color.grey(0.5); Pen.strokeRect(Rect.aboutRedVector3D(RedVector[width/2, height/2, depth], width/2, width, height, depth, ss, ff)); Pen.strokeC ...
-
... width; height = me.bounds.height; q.morph.updatedContacts.keysValuesDo({|k, me| Pen.color = contactColor; Pen.addOval(Rect.aboutPoint(([me.x, me.y] * [width, height]).asPoint, me.force * 1000, me.force * 1000)); Pen.fill; Pen.color = avgCol ...
-
... a*2]; line.update; //--render line.render(1, 100); //1= exaggerate, 2= standard Pen.translate(width*0.5, height*0.5); Pen.strokeColor= Color.white; line.drawOutlines; Pen.fillColor= Color.white; line.draw(10); //dotSize }; w.play; CmdPeriod ...
-
... 2]; plane.update; //--render plane.render(1, 300); //1= exaggerate, 2= standard Pen.translate(width*0.5, height*0.5); Pen.strokeColor= Color.white; plane.drawOutlines; Pen.fillColor= Color.white; plane.draw(10); //dotSize }; w.play; CmdPeri ...
-
... c,vel,acc,mass,size hypercubes= {|i| Red4DTesseract()}.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]; hypercubes[i].rotation= RedVector.new ...
-
... and], nil, 15, pixelSize); //world,loc,vel,acc,mass,size }; }; //--loop w.draw{ Pen.smoothing_(false); Pen.strokeColor= Color.green; rep.loc= w.mouse/[wn, hn]; Pen.strokeRect(Rect.aboutPoint(rep.loc.round.asPoint*[wn, hn], pixelSize, pixelS ...