Core HTML5 Canvas: Graphics, Animation, and Game Development (häftad)
Format
Häftad (Paperback)
Språk
Engelska
Antal sidor
752
Utgivningsdatum
2012-05-22
Upplaga
1
Förlag
PRENTICE-HALL
Illustrationer
illustrations
Volymtitel
Volume 1
Dimensioner
228 x 177 x 25 mm
Vikt
952 g
Antal komponenter
1
ISBN
9780132761611

Core HTML5 Canvas: Graphics, Animation, and Game Development

Volume 1: Canvas

Häftad,  Engelska, 2012-05-22

Slutsåld

One of HTML5s most exciting features, Canvas provides a powerful 2D graphics API that lets you implement everything from word processors to video games. In Core HTML5 Canvas, best-selling author David Geary presents a code-fueled, no-nonsense deep dive into that API, covering everything you need to know to implement rich and consistent web applications that run on a wide variety of operating systems and devices.

Succinctly and clearly written, this book examines dozens of real-world uses of the Canvas API, such as interactively drawing and manipulating shapes, saving and restoring the drawing surface to temporarily draw shapes and text, and implementing text controls. Youll see how to keep your applications responsive with web workers when you filter images, how to implement smooth animations, and how to create layered, 3D scrolling backgrounds with parallax. In addition, youll see how to implement video games with extensive coverage of sprites, physics, collision detection, and the implementation of a game engine and an industrial-strength pinball game. The book concludes by showing you how to implement Canvas-based controls that you can use in any HTML5 application and how to use Canvas on mobile devices, including iOS5. This authoritative Canvas reference covers
  • The canvas elementusing it with other HTML elements, handling events, printing a canvas, and using offscreen canvases
  • Shapesdrawing, dragging, erasing, and editing lines, arcs, circles, curves, and polygons; using shadows, gradients, and patterns
  • Textdrawing, positioning, setting font properties; building text controls
  • Imagesdrawing, scaling, clipping, processing, and animating
  • Animationscreating smooth, efficient, and portable animations
  • Spritesimplementing animated objects that have painters and behaviors
  • Physicsmodeling physical systems (falling bodies, pendulums, and projectiles), and implementing tweening for nonlinear motion and animation
  • Collision detectionadvanced techniques, clearly explained
  • Game developmentall aspects of game development, such as time-based motion and high score support, implemented in a game engine
  • Custom controlsinfrastructure for implementing custom controls; implementing progress bars, sliders, and an image panner
  • Mobile applicationsfitting Canvas apps on a mobile screen, using media queries, handling touch events, and specifying iOS5 artifacts, such as app icons
Throughout the book, Geary discusses high-quality, reusable code to help professional developers learn everything they really need to know, with no unnecessary verbiage. All of the books code and live demonstrations of key techniques are available at corehtml5canvas.com .
Visa hela texten

Kundrecensioner

Har du läst boken? Sätt ditt betyg »

Fler böcker av David Geary

Övrig information

David Geary is the president of Clarity Training, Inc. and a prominent author, speaker, and consultant, David wrote the best-selling books on the Java component frameworks, Swing and JavaServer Faces. David's Graphic Java: Swing is the all-time, best-selling Swing book and Core JSF, which David wrote with Cay Horstman, is the best-selling book on JavaServer Faces. David was one of a handful of experts on the JSF Expert Group (EG) that actively defined the standard Java-based web application framework. David has spoken at more than 100 NFJS symposiums since 2003, and he also speaks at other conferences such as TheServerSide Java Symposium, JavaOne, JavaPolis, and JAOO and is a three-time JavaOne rock star.

Innehållsförteckning

Preface xv

Acknowledgments xxiii

About the Author xxv

 

Chapter 1: Essentials 1

1.1 The canvas Element 1

1.2 Canvas Contexts 8

1.3 Canonical Examples in This Book 12

1.4 Getting Started 14

1.5 Fundamental Drawing Operations 22

1.6 Event Handling 26

1.7 Saving and Restoring the Drawing Surface 33

1.8 Using HTML Elements in a Canvas 36

1.9 Printing a Canvas 46

1.10 Offscreen Canvases 51

1.11 A Brief Math Primer 53

1.12 Conclusion 64

 

Chapter 2: Drawing 65

2.1 The Coordinate System 67

2.2 The Drawing Model 68

2.3 Drawing Rectangles 70

2.4 Colors and Transparency 72

2.5 Gradients and Patterns 76

2.6 Shadows 83

2.7 Paths, Stroking, and Filling 88

2.8 Lines 103

2.9 Arcs and Circles 124

2.10 Bzier Curves 137

2.11 Polygons 144

2.12 Advanced Path Manipulation 150

2.13 Transformations 170

2.14 Compositing 181

2.15 The Clipping Region 187

2.16 Conclusion 198

 

Chapter 3: Text 201

3.1 Stroking and Filling Text 202

3.2 Setting Font Properties 207

3.3 Positioning Text 210

3.4 Implementing Text Controls 225

3.5 Conclusion 252

 

Chapter 4: Images and Video 253

4.1 Drawing Images 254

4.2 Scaling Images 259

4.3 Drawing a Canvas into a Canvas 266

4.4 Offscreen Canvases 270

4.5 Manipulating Images 274

4.6 Clipping Images 302

4.7 Animating Images 306

4.8 Security 312

4.9 Performance 313

4.10 A Magnifying Glass 321

4.11 Video Processing 328

4.12 Conclusion 337

 

Chapter 5: Animation 339