-
... |x| x.notNil}; }.flat; syns= {Synth(\imp2)}.dup(n); //--loop w.draw{ //--render Pen.smoothing= true; Pen.strokeColor= Color.white; sprs.do{|spr| spr.update; //--render springs Pen.moveTo(spr.object.loc.asPoint); Pen.lineTo(spr.target.loc.as ...
-
... Rock(world, RedVector2D[width.rand, height].rand)}.dup(rocks); //--loop w.draw{ Pen.width= 1; world.objects.do{|o, i| //iterate all objects in this world o.addForce(o.world.gravity); //add gravity world.objects.copyToEnd(i+1).do{|oo| o.coll ...
-
... on.set(mx, my, 0); particles[0][gridSize-1].velocity.clear; px= mx; py= my; }); Pen.color= Color.black; gridSize.do{|i| Pen.moveTo(Point(particles[i][0].position.x, particles[i][0].position.y)); gridSize.do{|j| //particles[i][j].position.x. ...
-
... s: // Find/make a dataset of points: x = 15.collect{[1.0.rand, 1.0.rand]}; // Append the index onto the end, for later reference x = x.collect{|data, i| data ++ i }; // Use the KDTree quark and the .makeBufferData method to put the data in ...
-
... y, 0)}; usr.mouseMoveAction= usr.mouseDownAction; usr.drawFunc= { physics.tick; Pen.width= 0.1; Pen.strokeColor= Color.grey(0, sin(usr.frame%1000/1000*2pi)*0.5+0.5); physics.springs.do{|s, i| Pen.moveTo(Point(s.getOneEnd.position.x, s.getOn ...
-
//Simple_Pendulum //Originally created by Jeffrey Traer Bernstein http://murderandcreate.com/physics/ ( var width= 400, height= 400; var win= Window("Simple Pendulum", Rect(100, 100, width, height), false); var usr= UserView(win, Rect(0, 0, ...
-
... , {|x| a.noise1D(x/100, 0.75, 3, 0)}).normalize.plot //interpolation off //--1d pen test ( var width= 300, height= 300, w, u, a, persistance= 0.75, octaves= 8; w= Window("perlin test 1d", Rect(128, 64, width, height), false); u= UserView(w, ...
-
... addForce(obj.gravityForce(rep).neg); obj.update; world.contain(obj); //--render Pen.strokeColor= Color.green; Pen.strokeRect(Rect.aboutRedObject2D(rep)); Pen.strokeColor= Color.white; Pen.strokeRect(Rect.aboutRedObject2D(obj)); }; w.play; C ...
-
... ddForce(obj.viscosityForce(vv)); }); obj.update; world.contain(obj); //--render Pen.fillColor= Color.yellow; Pen.fillRect(visc); Pen.strokeColor= Color.white; Pen.strokeRect(Rect.aboutRedObject2D(obj)); }; w.play; CmdPeriod.doOnce({w.close} ...
-
//some pendulums drifting and coming to a halt ( var width= 640, height= 480, w, wgrav, world, ypos; //--world w= RedWindow("pendulum test5", Rect(128, 64, width, height)).front; w.clearOnRefresh= false; wgrav= RedVector2D[0, 0]; world= Red ...