Limit search to available items
Book Cover
Author Ramtal, Dev, author.

Title Physics for javascript games, animation, and simulations : with HTML5 canvas / Dev Ramtal and Adrian Dobre
Published [New York, NY] : Apress, [2014]
New York : Distributed to the Book trade worldwide by Springer Science+Business Media New York


Description 1 online resource (1 volume) : illustrations
Series Expert's Voice in Web Development
Expert's voice in Web development.
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 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 infor
Notes Includes index
Place of publication taken from publisher's Web site
Online resource; title from title page (Safari, viewed March 18, 2015)
Subject Physics -- Computer simulation
Computer games -- Programming.
JavaScript (Computer program language)
HTML (Document markup language)
Computer games -- Programming.
HTML (Document markup language)
JavaScript (Computer program language)
Physics -- Computer simulation.
Form Electronic book
Author Dobre, Adrian, 1971- author.
ISBN 9781430263388