Foundation HTML5 Animation with JavaScript cover

Foundation HTML5 Animation with JavaScript

No rating yet
Word count
553K words
Chapters
24
ISBN
9787115315472

Tags

Summary

Foundation HTML5 Animation with JavaScript is the Chinese translation of the English book of the same title, published by Posts & Telecom Press in 2013 under license from Apress Media, translated by Xu Ning and Li Qiang. The book uses the HTML5 canvas element as its medium, writing scripted animation by hand in native JavaScript without relying on any third-party animation library and without using WebGL. The book has 19 chapters in five parts. Part One, "JavaScript Animation Basics," introduces the basic concepts of animation, the relationship between frames and motion, the animation loop and requestAnimationFrame, JavaScript objects and prototypes, mouse, touch, and keyboard interaction, and canvas rendering techniques (colors, paths, curves, gradients, images, and pixel manipulation). Part Two, "Basic Motion," covers velocity vectors, acceleration, boundaries and friction, and user drag interaction. Part Three, "Advanced Motion," goes deeper into easing and bouncing, springs, collision detection, coordinate rotation and bouncing off inclined surfaces, billiard physics, particles and gravity, forward kinematics (making a character walk), and inverse kinematics (dragging and reaching). Part Four, "3D Animation," moves from the principles of perspective to 3D lines and fills, backface culling and 3D lighting, and matrix math. Part Five, "Other Techniques," offers practical tips and tricks. The book touches on trigonometry, vectors, conservation of momentum, and more, with runnable code examples that help readers understand both the math and physics behind scripted animation and actually build games, interactive pages, and visual effects. It is suitable for front-end and creative developers working with HTML5 or moving from Flash to JavaScript.

Editor's review

很多前端开发者做动画时第一反应是找一个库,结果只会调API,一旦需求变化就无从下手。这本书走的是另一条路:用几百行手写代码,把“运动”这件事从原理层面讲透。 它的难得之处在于体系完整。从最基础的帧与动画循环,到三角学、速度向量、缓动弹簧、碰撞检测、撞球物理、粒子引力,再到正向和反向运动学与三维透视、矩阵,一条线串到底,几乎覆盖了2D交互动画的全部常用模型。每个概念都配可运行的canvas示例,公式与代码一一对应,读者可以边跑边改、边改边看。 对从Flash时代过来的人来说,它相当于把当年ActionScript动画的经典思路平移到了HTML5 canvas;对纯前端来说,它补上了学校里没教、框架里也没有的运动学与物理直觉。虽然书中示例写于HTML5早期,部分API与浏览器支持情况已有变化,但背后的数学与建模方法并不过时,反而在canvas特效、数据可视化动效、小游戏开发中依然直接可用。

Who it's for

A good fit for

  • 已有HTML、CSS和JavaScript基础,想进一步做canvas动画的前端开发者
  • 从Flash或ActionScript转向HTML5的创意开发人员
  • 做小游戏、交互页面、数据可视化动效,需要手写动画逻辑的工程师
  • 对脚本动画背后的数学与物理(三角学、向量、运动学)感兴趣的在校学生

Not a good fit for

  • 完全没有编程经验、需要从零学JavaScript的初学者
  • 只想用CSS动画或现成框架快速实现页面效果、不想深究原理的人
  • 寻找React/Vue等现代前端框架实战内容的读者

Reading tips

  1. 先读第2至4章,把动画循环、requestAnimationFrame和canvas绘图API跑通,再进入运动部分。
  2. 务必边读边敲代码:自己建一个HTML文件,把书中的示例改参数、换图形,观察运动变化。
  3. 第10至14章的旋转、碰撞与运动学难度较高,可配合草稿纸推导公式,或先跳到3D部分再回读。
  4. 把每章的物理模型整理成可复用的小函数库,作为日后做特效和小游戏的工具箱。

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Part One JavaScript Animation Basics
  2. Chapter 1 Basic Concepts of Animation
  3. Chapter 2 JavaScript Basics for Animation: HTML5 and canvas support, the animation loop, requestAnimationFrame, JavaScript objects, user interaction (mouse, touch, keyboard)
  4. Chapter 3 Trigonometry for Animation: radians and degrees, the canvas coordinate system, trigonometric functions, rotation, waves, circles and ellipses, the Pythagorean theorem
  5. Chapter 4 Rendering Techniques: canvas colors and transparency, the drawing API, paths and curves, gradient fills, loading images and video, manipulating pixels
  6. Part Two Basic Motion
  7. Chapter 5 Velocity Vectors and Acceleration
  8. Chapter 6 Boundaries and Friction
  9. Chapter 7 User Interaction: Moving Objects
  10. Part Three Advanced Motion
  11. Chapter 8 Easing and Bouncing
  12. Chapter 9 Collision Detection
  13. Chapter 10 Coordinate Rotation and Bouncing off Inclined Surfaces
  14. Chapter 11 Billiard Physics
  15. Chapter 12 Particles and Gravity
  16. Chapter 13 Forward Kinematics: Making Things Walk
  17. Chapter 14 Inverse Kinematics: Dragging and Reaching
  18. Part Four 3D Animation
  19. Chapter 15 3D Basics
  20. Chapter 16 3D Lines and Fills
  21. Chapter 17 Backface Culling and 3D Lighting
  22. Chapter 18 Matrix Math
  23. Part Five Other Techniques
  24. Chapter 19 Tips and Tricks

FAQ

这本书需要什么基础?
需要掌握HTML、CSS和基本JavaScript语法(变量、函数、对象、事件)。书中第2章会简要回顾JavaScript对象与原型,但不会系统教语言入门;数学部分从三角函数讲起,有初中到高中基础即可跟上。
这本书用的是WebGL还是canvas?
全书以HTML5的canvas 2D绘图API为基础,用原生JavaScript手写动画,不讲解WebGL。后四章的三维内容是用2D canvas模拟透视投影、背面剔除与光照,帮助读者理解3D图形学的基本原理。
中文版和原版内容一致吗?
中文版据Apress 2011年出版的《Foundation HTML5 Animation with JavaScript》译出,全书393页,约55.3万字,目录结构与原版19章一致,由徐宁、李强翻译,人民邮电出版社2013年6月出版。
现在读还不过时吗?
书中示例写于HTML5早期,部分API(如旧版浏览器前缀、触摸事件写法)与今天的实践有差异,但动画循环、帧率控制、运动学与物理建模等核心内容依然通用,配合现代浏览器阅读收获仍然很大。
适合当作游戏开发入门书吗?
书中有碰撞检测、动量守恒、撞球物理、粒子引力、正向与反向运动学等内容,是横版游戏和交互玩具的常见底层模型;但它不讲游戏框架、资源管理、关卡设计等内容,只能作为动画与物理部分的入门。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

Top rated in the same category