1 option
Physics for JavaScript Games, Animation, and Simulations : with HTML5 Canvas / by Adrian Dobre, Dev Ramtal.
- Format:
- Book
- Author/Creator:
- Dobre, Adrian., Author.
- Ramtal, Dev., Author.
- Series:
- Expert's voice in Web development.
- Expert's Voice in Web Development
- Language:
- English
- Subjects (All):
- Computer games—Programming.
- Software engineering.
- Game Development.
- Software Engineering/Programming and Operating Systems.
- Local Subjects:
- Game Development.
- Software Engineering/Programming and Operating Systems.
- Physical Description:
- 1 online resource (490 p.)
- Edition:
- 1st ed. 2014.
- Place of Publication:
- Berkeley, CA : Apress : Imprint: Apress, 2014.
- Language Note:
- English
- System Details:
- text file
- 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.
- Contents:
- 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
- Notes:
- Includes index.
- ISBN:
- 9781430263388
- 1430263385
- OCLC:
- 905853350
The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.