Physics for JavaScript Games, Animation, and Simulations : With HTML5 Canvas / by Dev Ramtal, Adrian Dobre
Contributor(s): Resource type: Ressourcentyp: Buch (Online)Book (Online)Language: English Series: SpringerLink BücherPublisher: [Berkeley, Calif.] : Apress, 2014Description: Online-Ressource (XXIV, 466 p. 182 illus, online resource)ISBN:- 9781430263388
- 004
- QA75.5-76.95
Contents:
Summary: "Have you ever wanted to include believable physical behaviors in your games and projects to give them that extra edge? Physics for JavaScript Games, Animation, and Simulations teaches you how to incorporate real physics, such as gravity, friction, and buoyancy, into your HTML5 games, animations, and simulations. It also includes more advanced topics, such as particle systems, which are essential for creating effects such as sparks or smoke. The book also addresses the key issue of balancing accuracy and simplicity in your games and simulations, and the final chapters provide you with the information and the code to make the right choice for your project. Physics for JavaScript Games, Animation, and Simulations assumes you have a basic knowledge of JavaScript and HTML5. However, no previous knowledge of physics is required - only some very basic math skills. The authors present everything from basic principles to advanced concepts in an approachable way, so you'll be able to follow the logic and easily adapt the principles to your own applications. The book is packed full of practical examples of how you can apply physics to your own games and applications. Spring behaviors can be used for anything from tweaking lowrider suspension to creating cloth simulation; flotation mechanics enable the simulation of submersibles or dirigibles; you can even create your own solar system with accurate orbits and gravity. It doesn't matter if you're modeling the Lorentz force in an electromagnetic field or you're modeling the lift force in a flight simulator, Physics for JavaScript Games, Animation, and Simulations enables you to fill your games and applications with accurate and realistic effects. What you'll learn: Learn all the basic math and physics you'll need to incorporate realism into your projects; Incorporate a wide range of forces, such as gravity, friction, and buoyancy; Build a number of realistic simulations; Model particle systems and use them to create visual effects; Create complex systems using rigid bodies and mass-spring systems; Deal with numerical subtleties, including accuracy and stability of integration schemes. This book is for JavaScript developers interested in incorporating real physics into their games, animations, simulations, or generative art projects."--Summary: Have you ever wanted to include believable physicalbehaviors in your games and projects to give them that extra edge? Physics for JavaScript Games, Animation, andSimulations teaches you how to incorporate real physics, such as gravity,friction, and buoyancy, into your HTML5 games, animations, and simulations. Italso includes more advanced topics, such as particle systems, which areessential for creating effects such as sparks or smoke. The book also addressesthe key issue of balancing accuracy and simplicity in your games andsimulations, and the final chapters provide you with the information and thecode to make the right choice for your project. Physics for JavaScriptGames, Animation, and Simulations assumes you have a basic knowledge ofJavaScript and HTML5. However, no previous knowledge of physics isrequired-only some very basic math skills. The authors present everything frombasic principles to advanced concepts in an approachable way, so you’ll be ableto follow the logic and easily adapt the principles to your own applications. The book is packed full of practical examples of how you canapply physics to your own games and applications.Spring behaviors can be used for anything from tweaking lowrider suspension tocreating cloth simulation; flotationmechanics enable the simulation of submersibles or dirigibles; you can even createyour own solar system with accurate orbits and gravity. It doesn’t matter ifyou’re modeling the Lorentz force in an electromagnetic field or you’remodeling the lift force in a flight simulator, Physics for JavaScript Games, Animation, and Simulations enablesyou to fill your games and applications with accurate and realistic effectsPPN: PPN: 1658592794Package identifier: Produktsigel: ZDB-2-CWD
Contents at a Glance; Introduction; Part I: The Basics; Chapter 1: Introduction to Physics Programming; Why model real physics?; Creating realistic animation effects; Creating realistic games; Building simulations and models; Generating art from code; What is physics?; Everything behaves according to the laws of physics; The laws can be written as math equations; Predicting motion; Programming physics; The difference between animation and simulation; The laws of physics are simple equations; Equations can be readily coded up!; The four steps for programming physics
A simple physics simulation exampleThe physics of a bouncing ball; Coding up a bouncing ball in 2D; Some code at last!; Summary; Chapter 2: JavaScript and HTML5 Canvas Basics; HTML5, the canvas element, and JavaScript; A minimal HTML5 document; The canvas element; Adding JavaScript; The JavaScript debugging console; JavaScript objects; Objects and properties; Functions and methods; Prototypes, constructors, and inheritance; Static properties and methods; Example: a Ball object; JavaScript frameworks, libraries, and APIs; JavaScript language basics; Variables; Data types; Numbers; Strings
BooleansUndefined and Null; Objects, Functions, and Arrays; Operators; Math; Logic; Loops; Events and user interaction; Event listeners and handlers; User interaction: keyboard, mouse, and touch events; Drag and drop; The canvas coordinate system; The canvas drawing API; The canvas context; Drawing lines and curves; Creating fills and gradients; Animating using the canvas context; Producing animation using code; Using JavaScript timers; Using requestAnimationFrame(); Using getTime() to compute elapsed time; Precalculating motion; Summary; Chapter 3: Some Math Background
Coordinates and simple graphsBuilding a plotter: the Graph object; Plotting functions using the Graph object; Drawing straight lines; Drawing polynomial curves; Things that grow and decay: exponential and log functions; Making an object move along a curve; Fun with hills; The trouble with circles; Using parametric equations; Finding the distance between two points; Basic trigonometry; Degrees and radians; The sine function; The cosine function; The tangent function; The inverse trig functions; Using trig functions for animation; Wavelength, period, frequency and angular frequency
OscillationsDamped oscillations; Combining sine waves; Vectors and basic vector algebra; What are vectors?; Vectors vs. scalars; Adding and subtracting vectors; Resolving vectors: vector components; Position vectors; Adding vectors using components; Multiplying a vector by a number; Vector magnitude; Vector angle; Multiplying vectors: Scalar or dot product; Multiplying vectors: Vector or cross product; Building a Vector object with vector algebra; Simple calculus ideas; Slope of a line: gradient; Rates of change: derivatives; Discrete calculus: difference equations; Doing sums: integrals
Summary
No physical items for this record