Physics for javascript games, animation, and simulations : with HTML5 canvas /
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...
Clasificación: | Libro Electrónico |
---|---|
Autores principales: | , |
Formato: | Electrónico eBook |
Idioma: | Inglés |
Publicado: |
[New York, NY] :
Apress,
[2014]
|
Colección: | Expert's voice in Web development.
|
Temas: | |
Acceso en línea: | Texto completo (Requiere registro previo con correo institucional) |
Tabla de Contenidos:
- 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.