Gravitational game: PlaySpace

time:10-09-17 forum:HTML web page, JS language and code
  Reprinted from http://bbs.51js.com/viewthread.php? Tid=87655.amp; extra=page=1

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:



prev:Ji'nan municipal residents' health insur... next:War game engine based on HTML5
post comment
Notice



approved   May 1 go to these scenic spots to pl...   Do not work to go to school and not ...   Tea table "dark words"   Bazhong man built a small wooden bri...   The army flags the banner of the fla...
rand   5 classic HTML5 flight fighter games   DIV CSS picture slice   Javascript displays refreshing conte...   The beautiful loading progress bar i...   Display special progress bar and tra...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com