-
... accel, vel and loc world.contain(o); //keep object within the world //--render Pen.fillColor= Color.grey(1-(o.mass/12), 0.5); Pen.fillOval(Rect.aboutRedObject2D(o)); }; }; w.play; CmdPeriod.doOnce({w.close}); )
-
... .mouse; }); //o.addForce(world.gravity); o.update; world.contain(o); //--render Pen.fillColor= Color.grey(1-(i/n), 0.5); Pen.fillOval(Rect.aboutRedObject2D(o)); }; }; w.play; CmdPeriod.doOnce({w.close}); )
-
... thin a world with gravity force and also collision detection //color and size depends on object's mass //sound - collision velocity mapped to amplitude, mass to dur and freq ( s.waitForBoot{ var width= 300, height= 300, w, wgrav, world, n= ...
-
... dForce(world.gravity); o.addForce(wind); o.update; world.contain(o); //--render Pen.strokeColor= Color.grey(o.mass/4); Pen.strokeRect(Rect.aboutRedObject2D(o)); }; }; w.play; CmdPeriod.doOnce({w.close}); )
-
... 2D[0, sys.wave.wrapAt(i)]; o.addForce(world.gravity); }; sys.update; //--render Pen.fillColor= Color.grey(1, 0.4); sys.do{|o, i| Pen.fillOval(Rect.aboutRedObject2D(o)); }; }; w.play; CmdPeriod.doOnce({w.close}); )
-
... i| o.addForce(world.gravity); o.update; if(o.age<=0, {dead.add(o)}); //--render Pen.fillColor= Color.red; Pen.addOval(Rect.aboutRedVector2D(o.loc, o.age)); Pen.fill; }; dead.do{|o| world.remove(o)}; }; w.play; CmdPeriod.doOnce({w.close}); ) ...
-
... -1; synths[i].set(\amp, amp, \freq, freq, \pan, pan); }; sys.update; //--render Pen.fillColor= Color.grey(1, 0.4); sys.do{|o, i| if(i.odd, { Pen.fillOval(Rect.aboutRedObject2D(o)); }, { Pen.fillRect(Rect.aboutRedObject2D(o)); }); }; }; w.pl ...
-
... orce(o.gravityForce(oo).neg); }); }); }; o.update; world.contain(o); //--render Pen.fillColor= Color.hsv(0.4, 1-(o.mass/12), 1, o.mass/12); Pen.fillRect(Rect.aboutPoint(o.loc.asPoint, 0.5, 0.5)); }; }; w.play; CmdPeriod.doOnce({w.close}); )
-
... position as a Point . . clear Clears the drawing. . close Close the window if open. . width Set Pen stroke width. . strokeColor Set Pen stroke colour. . background Set drawing background colour. Inherited instance methods Examples a= Redra ...
-
... (i-1).loc); //o.addForce(world.gravity); o.update; world.contain(o); //--render Pen.strokeColor= Color.grey((depth-o.loc[2]/(depth*0.5)).clip(0, 1)); Pen.strokeOval(Rect.aboutRedObject3D(o, s, f)); }; }; w.play; CmdPeriod.doOnce({w.close}); ...