Gravitational game: PlaySpace
see here: [url=http://lxcww.com/wp/? P=347:176usm87]http://lxcww.com/wp/? P=347[/url:176usm87]
to achieve the desired effect, it is best to run the program ^_^
basic play with Chrome/Safari:
1, hold down And slide the mouse, producing a lot of particles.
2 and double-click the mouse, get a much larger mass than the planet and its satellite particles.
3, play with your imagination!
[code]
.Lt; p.gt;.Lt; canvas id=.quot; cvs.quot; height=.quot; 480.quot; width=.quot; 640.quot. 'Book antiqua'; width: 640px;.Quot;.Gt;
.lt; div style=.quot; float: right. Uot; satelliteNum =satelliteNum==20? -20:1, this.innerHTML = 'satellite =' satelliteNum.quot;.Gt; satellite =10.lt; /button.gt;.Lt; button onclick=.quot; NitialSpeed=initialSpeed? False:true; this.innerHTML = 'initial velocity of particle =' initialSpeed.quot;.Gt; initial particle velocity =false.lt; /button.gt;.Lt; button onclick=.quot; reflectible=reflectible false:true; boundary = 'boundary reflection =' Div style=.quot; float: right;.Quot;.Gt;.Lt; button style=.quot; background: #ffffff. .lt; button onclick=.quot; showGrid=showGrid? False:true; this.innerHTML = 'display grid =' showGrid; controller.render (true);.Quot;.Gt; display grid =false.lt; E):): null.quot;.Gt; erasure mode =false.lt; /button.gt;.Lt; button onclick=.quot; controller.clearParticle ().Quot;.Gt; clearance of particle.Lt; ().Quot;.Gt; clear screen.Lt; /button.gt;.Lt; button onclick=.quot; running? (running = false, controller.stop); this.innerHTML = 'stop'); Button.gt;.Lt; /div.gt;
.lt; /div.gt;
.lt; p.gt;.Lt; script src=.quot. TML5 Canvas. Try using Chrome, Safari, Opera, IE9 or FireFox.
You can modify part of the code first and run
order:
in erasure mode, erasing stars and particles, double clicking the mouse can change the size of the erasure tool.
hold Ctrl and mouse keys to continue to produce particles.
opening particle initial speed option enables particles to get initial speed, and its value is determined by mouse trajectory. The combination of
particle initial velocity and Ctrl function can generate continuous particles with initial velocity, which is one of the ways to create beautiful curves.
holding down Shift and mouse keys can produce particles in horizontal or vertical direction.
particles around the planet can affect the radius of the planet. The more particles, the closer the distance is, the greater the radius of the planet.
click stop button, you can create in static space, click the button again to resume movement.
click the color button to choose the next planet and particle color.
click the save image button to generate a PNG picture and right click to save it as a local image.
by creating different gravitational fields, we can observe the trajectories of particles and produce all kinds of wonderful patterns. When
opens the planetary mobile mode, the attraction between the stars will work, and the attraction of the particles to the planet will be ignored.
game screenshot: