Foundation HTML5 Animation with JavaScript is a fantastic resource for all web developers working in HTML5 or switching over from Flash to create standards compliant new-technology games, applications, and animations that will work across all modern browsers and most mobile devices, including iPhones, iPads, and Android devices.

At the beginning of the book, you will build the Doodle.js JavaScript library, which reworks the majority of the ActionScript graphics routines into JavaScript. Once this library is in place, it becomes a simple matter create the amazing animation and physics-based code originally created by Keith Peters in his hugely successful Foundation ActionScript Animation book.

The book provides information on all the relevant trigonometry you will need, before moving on to physics concepts such as acceleration, velocity, easing, springs, collision detection, conservation of momentum, 3D, and forward and inverse kinematics. In no time at all, you'll both understand the concepts behind scripted animation and have the ability to create all manner of exciting animations and games.

Contents

  1. Part One: Animation Basics

    1. Chapter 1: Basic Animation Concepts

    2. Chapter 2: Basics of ActionScript 3.0 for Animation

      1. Listeners and Handlers
      2. Events for Animation
      3. The Display List
      4. Subclassing Display Objects
      5. Mouse Events
      6. Keyboard Events
      7. Key Codes
    3. Chapter 3: Trigonometry for Animation

      1. Rotation
      2. Smooth Up and Down Motion
      3. Linear Vertical Motion
      4. Pulsing Motion
      5. Waves with Two Angles
      6. Waves with the Drawing API
      7. Circular Movement
      8. Elliptical Movement
      9. Distance Between Two Points
      10. Mouse Distance
    4. Chapter 4: Rendering Techniques

  2. Part Two: Basic Motion

    1. Chapter 5: Velocity and Acceleration

      1. Velocity on One Axis
      2. Velocity on Two Axes
      3. Velocity Angle
      4. Mouse Follower
      5. Velocity Extended
      6. Acceleration on One Axis
      7. Acceleration on One Axis with Keys
      8. Acceleration on Two Axis
      9. Gravity as Acceleration
      10. Angular Acceleration
      11. Spaceship
    2. Chapter 6: Boundaries and Friction

      1. Removing Objects
      2. Regenerating Objects
      3. Screen Wrapping
      4. Bouncing
      5. Bouncing - Adjust Bounce
      6. Friction, the Right Way
      7. Friction, the Easy Way
      8. Friction Applied
    3. Chapter 7: User Interaction: Moving Objects Around

      1. Pressing and Releasing a Sprite
      2. Dragging with mouseMove
      3. Combining Dragging with Motion
      4. Throwing
  3. Part Three: Advanced Motion

    1. Chapter 8: Easing and Springing

      1. Simple Easing 1
      2. Simple Easing 2
      3. When to Stop Easing
      4. A Moving Target
      5. Springing in One Dimension
      6. Springing in One Dimension with Friction
      7. Springing in Two Dimensions
      8. Springing to a Moving Target
      9. Show the Spring
      10. Chaining Springs
      11. Chaining Springs - multiple
      12. Springing to Multiple Targets
      13. Offsetting the Target
      14. Attaching Multiple Objects with Springs - Double
      15. Attaching Multiple Objects with Springs - Triple
    2. Chapter 9: Collision Detection

      1. Hit Testing Two Sprites
      2. Hit Testing Two Sprites - Stack Boxes
      3. Hit Testing a Sprite and Point
      4. Simple Distance-Based Collision Detection
      5. Simple Distance-Based Collision Detection - Different Radius
      6. Collision-Based Springing
      7. Multiple-Object Springing
    3. Chapter 10: Coordinate Rotation and Bouncing Off Angles

      1. Simple Coordinate Rotation
      2. Rotating a Single Object
      3. Rotating Multiple Objects
      4. Bouncing Off an Angle
      5. Bouncing Off an Angle - Optimized
      6. Bouncing Off an Angle - Bounds Checking
      7. Bouncing Off an Angle - Fix "Under the Line" Problem
      8. Bouncing Off Multiple Angles
    4. Chapter 11: Billiard Ball Physics

      1. Conservation of Momentum on One Axis
      2. Conservation of Momentum on One Axis - Optimized
      3. Conservation of Momentum on Two Axes
      4. Conservation of Momentum on Two Axes - Optimized
      5. Adding More Objects
      6. Solving a Potential Problem
    5. Chapter 12: Particle Attraction and Gravity

      1. Gravitational Force
      2. Collision Detection and Reaction
      3. Collision Detection and Reaction - Different Radius
      4. Orbiting
      5. A Springy Node Garden
      6. Nodes with Connections
      7. Nodes with Mass
    6. Chapter 13: Forward Kinematics: Making Things Walk

      1. Show Segments
      2. Moving One Segment
      3. Moving Two Segments
      4. Moving Two Segments - And Rotate
      5. Automating the Process
      6. Building a Natural Walk Cycle
      7. Building a Natural Walk Cycle - Offset Segment
      8. Building a Natural Walk Cycle - Two Legs
      9. Making it Dynamic
      10. Making it Really Walk
    7. Chapter 14: Inverse Kinematics: Dragging and Reaching

      1. Reaching with a Single Segment
      2. Dragging with a Single Segment
      3. Dragging Two Segments
      4. Dragging More Segments
      5. Reaching for the Mouse
      6. Reaching for the Mouse - Multiple Segments
      7. Reaching for an Object
      8. The Law of Cosines
      9. The Law of Cosines - Reverse
  4. Part Four: 3D Animation

    1. Chapter 15: 3D Basics

      1. Perspective
      2. Perspective - Check Z Position
      3. Velocity and Acceleration
      4. Single Object Bouncing
      5. Multiple Object Bouncing
      6. Z-Sorting
      7. Gravity
      8. Wrapping
      9. Wrapping - With Height
      10. Easing
      11. Springing
      12. Coordinate Rotation - Y Axis
      13. Coordinate Rotation - X and Y Axes
      14. Collision Detection
    2. Chapter 16: 3D Lines and Fills

      1. Creating Points and Lines
      2. Creating Points and Lines - Point3D
      3. Making Shapes - Spinning Square
      4. Making Shapes - Spinning Letter E
      5. Creating 3D Fills
      6. Using Triangles
      7. Modeling a Spinning Cube
      8. Modeling Other Shapes - Pyramid
      9. Modeling Other Shapes - Extruded Letter A
      10. Modeling Other Shapes - Cylinder
      11. Moving 3D Solids - Orbit Screen Center
      12. Moving 3D Solids - Orbit Model Center
    3. Chapter 17: Backface Culling and 3D Lighting

      1. Backface Culling
      2. Depth Sorting
      3. 3D Lighting
  5. Part Five: Additional Techniques

    1. Chapter 18: Matrix Math

      1. Coding with Matrices - Coordinate Rotation
      2. The Matrix Class
      3. The Matrix Class - Skew X
      4. The Matrix Class - Skew X and Y
    2. Chapter 19: Tips and Tricks

      1. Brownian (Random) Motion
      2. Brownian (Random) Motion - Draw
      3. Square Distribution
      4. Square Distribution - Compact
      5. Circular Distribution
      6. Circular Distribution - Even Throughout Circle
      7. Biased Distribution
      8. Biased Distribution - Multiple Iterations
      9. Biased Distribution - X and Y Axis
      10. Timer-Based Animation - Basic Timer
      11. Timer-Based Animation
      12. Time-Based Animation - Frame Independent
      13. Time-Based Animation - With Gravity
      14. Collisions Between Same-Mass Objects
      15. Integrating Sound