-
... ill, 0, 1, ~initSize.value)}.dup(seeds-1); //--loop w.draw{ var free, frozen; //Pen.smoothing= false; Pen.strokeColor= Color.black; //--separate free and frozen objects free= world.objects.select{|o| o.vel!=still}; frozen= world.objects.sel ...
-
... vel, 0, mass, mass*5); //world,loc,vel,acc,mass,size }.dup(n); //--loop w.draw{ Pen.strokeColor= Color.black; Pen.fillColor= Color.red(1, 0.7); world.objects.do{|o| var osize, freq, amp, pan; o.addForce(world.gravity); o.update; if(world.co ...
-
... ds Inherited class methods Instance methods draw play stop resize background isOpen mouse isPlaying userView animate frame frameRate Inherited instance methods Examples Classes (extension) | Red > redUniverse'>redUniverse RedJWindow Extensi ...
-
... ], RedVector2D[0, 0], 0, 0, 60); //world,loc,vel,acc,mass,size //--loop w.draw{ Pen.strokeColor= Color.white; world.objects.do{|o, i| //iterate all objects in this world world.objects.copyToEnd(i+1).do{|oo| o.collide(oo)}; o.update; //objec ...
-
... y, 0)}; usr.mouseMoveAction= usr.mouseDownAction; usr.drawFunc= { physics.tick; Pen.fillColor= Color.black; physics.particles.do{|p| Pen.addOval(Rect.aboutPoint(Point(p.position.x, p.position.y), p.mass, p.mass)); }; Pen.fill; }; win.front; ...
-
... y, 0)}; usr.mouseMoveAction= usr.mouseDownAction; usr.drawFunc= { physics.tick; Pen.fillColor= Color.black; physics.particles.do{|p| Pen.addOval(Rect.aboutPoint(Point(p.position.x, p.position.y), p.mass, p.mass)); }; Pen.fill; }; win.front; ...
-
... thin a world with gravity force and also collision detection //color and size depends on object's mass ( var width= 300, height= 300, w, wgrav, world, n= 20; //--world w= RedWindow("collision test", Rect(128, 64, width, height)).front; wgra ...
-
... points= {|i| Red3DPoint(RedVector3D[i+1/n-0.5, 0, 0])}.dup(n); //--loop w.draw{ Pen.fillColor= Color.white; world.objects.do{|o, i| thetas[i]= thetas[i]+speeds[i]; points[i].rotation= RedVector3D[thetas[i], thetas[i], thetas[i]]; points[i]. ...
-
... usr.mouseDownAction; usr.drawFunc= { physics.tick; physics.particles.do{|p, i| Pen.fillColor= Color.hsv(0.6, i/num, 0.7, 0.7); Pen.addOval(Rect.aboutPoint(Point(p.position.x, p.position.y), p.mass, p.mass)); Pen.fill; }; }; win.front; CmdP ...
-
... s= {|i| Red3DLine(RedVector3D[0, i+1/n-0.5, 0], 1.75)}.dup(n); //--loop w.draw{ Pen.strokeColor= Color.white; world.objects.do{|o, i| thetas[i]= thetas[i]+speeds[i]; lines[i].rotation= RedVector3D[thetas[i], thetas[i]/2+1, thetas[i]/3+2]; l ...