Core HTML5 Canvas : Graphics, Animation, and Game Development

Core HTML5 Canvas : Graphics, Animation, and Game Development

  • ただいまウェブストアではご注文を受け付けておりません。 ⇒古書を探す
  • 製本 Paperback:紙装版/ペーパーバック版/ページ数 723 p.
  • 言語 ENG
  • 商品コード 9780132761611
  • DDC分類 006.66

Full Description


One of HTML5's 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. You'll 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, you'll 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 element-using it with other HTML elements, handling events, printing a canvas, and using offscreen canvasesShapes-drawing, dragging, erasing, and editing lines, arcs, circles, curves, and polygons; using shadows, gradients, and patternsText-drawing, positioning, setting font properties; building text controlsImages-drawing, scaling, clipping, processing, and animatingAnimations-creating smooth, efficient, and portable animationsSprites-implementing animated objects that have painters and behaviorsPhysics-modeling physical systems (falling bodies, pendulums, and projectiles), and implementing tweening for nonlinear motion and animationCollision detection-advanced techniques, clearly explainedGame development-all aspects of game development, such as time-based motion and high score support, implemented in a game engineCustom controls-infrastructure for implementing custom controls; implementing progress bars, sliders, and an image pannerMobile applications-fitting 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 book's code and live demonstrations of key techniques are available at corehtml5canvas.com.

Contents

Preface xvAcknowledgments xxiiiAbout the Author xxvChapter 1: Essentials 11.1 The canvas Element 11.2 Canvas Contexts 81.3 Canonical Examples in This Book 121.4 Getting Started 141.5 Fundamental Drawing Operations 221.6 Event Handling 261.7 Saving and Restoring the Drawing Surface 331.8 Using HTML Elements in a Canvas 361.9 Printing a Canvas 461.10 Offscreen Canvases 511.11 A Brief Math Primer 531.12 Conclusion 64Chapter 2: Drawing 652.1 The Coordinate System 672.2 The Drawing Model 682.3 Drawing Rectangles 702.4 Colors and Transparency 722.5 Gradients and Patterns 762.6 Shadows 832.7 Paths, Stroking, and Filling 882.8 Lines 1032.9 Arcs and Circles 1242.10 Bezier Curves 1372.11 Polygons 1442.12 Advanced Path Manipulation 1502.13 Transformations 1702.14 Compositing 1812.15 The Clipping Region 1872.16 Conclusion 198Chapter 3: Text 2013.1 Stroking and Filling Text 2023.2 Setting Font Properties 2073.3 Positioning Text 2103.4 Implementing Text Controls 2253.5 Conclusion 252Chapter 4: Images and Video 2534.1 Drawing Images 2544.2 Scaling Images 2594.3 Drawing a Canvas into a Canvas 2664.4 Offscreen Canvases 2704.5 Manipulating Images 2744.6 Clipping Images 3024.7 Animating Images 3064.8 Security 3124.9 Performance 3134.10 A Magnifying Glass 3214.11 Video Processing 3284.12 Conclusion 337Chapter 5: Animation 3395.1 The Animation Loop 3405.2 Calculating Frame Rates 3585.3 Scheduling Tasks at Alternate Frame Rates 3595.4 Restoring the Background 3605.5 Double Buffering 3645.6 Time-Based Motion 3675.7 Scrolling the Background 3705.8 Parallax 3775.9 User Gestures 3835.10 Timed Animations 3855.11 Animation Best Practices 3905.12 Conclusion 391Chapter 6: Sprites 3936.1 Sprites Overview 3946.2 Painters 3986.3 Sprite Behaviors 4116.4 Sprite Animators 4176.5 A Sprite-Based Animation Loop 4246.6 Conclusion 425Chapter 7: Physics 4277.1 Gravity 4287.2 Warping Time 4507.3 Time-Warp Functions 4567.4 Warping Motion 4587.5 Warping Animation 4737.6 Conclusion 482Chapter 8: Collision Detection 4838.1 Bounding Areas 4838.2 Bouncing Off Walls 4888.3 Ray Casting 4908.4 The Separating Axis Theorem (SAT) and Minimum Translation Vector (MTV) 4958.5 Conclusion 541Chapter 9: Game Development 5439.1 A Game Engine 5449.2 The Ungame 5729.3 A Pinball Game 5899.4 Conclusion 614Chapter 10: Custom Controls 61510.1 Rounded Rectangles 61710.2 Progress Bars 62510.3 Sliders 63110.4 An Image Panner 64310.5 Conclusion 655Chapter 11: Mobile 65711.1 The Mobile Viewport 65911.2 Media Queries 66611.3 Touch Events 67111.4 iOS5 67711.5 A Virtual Keyboard 68211.6 Conclusion 701Index 703

最近チェックした商品