精通HTML5移动开发:实战指南

需积分: 10 5 下载量 92 浏览量 更新于2024-07-25 收藏 7.92MB PDF 举报
"HTML5 Mobile Development Cookbook 2012.pdf" HTML5移动开发烹饪手册是一部专为构建快速、响应式的HTML5移动网站而设计的指南,适用于iPhone 5、Android、Windows Phone和Blackberry等平台。作者Shi Chuan通过60多个实战配方,向读者展示了如何规划、构建、调试和优化移动网站,并利用最新的HTML5特性来提升移动网站的性能。 HTML5是Web开发领域的里程碑,它引入了一系列增强功能,特别适合于移动设备。这本书的核心知识点包括: 1. **响应式设计(Responsive Design)**:学习如何使用媒体查询(Media Queries)和流式布局(Fluid Grids)创建适应不同屏幕尺寸和方向的页面。 2. **离线存储(Offline Storage)**:利用HTML5的离线存储API,如AppCache和IndexedDB,实现离线访问网站内容,提高用户体验。 3. **表单控件(Form Controls)**:掌握新的HTML5表单元素和属性,如`<input type="date">`、`<input type="range">`,以及表单验证功能,以提供更友好的用户输入界面。 4. **画布(Canvas)**:学习如何使用JavaScript与Canvas API进行动态图形绘制,创建丰富的交互式内容。 5. **地理定位(Geolocation)**:了解如何获取用户的地理位置信息,以实现基于位置的服务。 6. **Web Workers和WebSockets**:掌握在后台运行脚本的Web Workers,以及实现实时双向通信的WebSockets,提高应用的性能和交互性。 7. **音频和视频处理(Audio & Video)**:学习如何直接在网页中嵌入和控制多媒体内容,支持多种格式。 8. **拖放功能(Drag and Drop)**:实现元素的拖放操作,提升用户体验。 9. **离线通知(Push Notifications)**:利用Service Worker和Web Push API实现离线状态下的推送通知。 10. **Web App Manifest**:学习如何使用Web App Manifest文件定义应用的元数据,使网站可以像原生应用一样安装在设备主屏幕上。 11. ** Progressive Web Apps (PWA)**:了解如何构建渐进式Web应用,提供接近原生应用的体验,包括离线可用性和即时加载。 12. **跨文档消息传递(Cross-document messaging)**:通过Window.postMessage API实现不同窗口或框架之间的安全通信。 13. **移动优化技巧**:学习如何针对移动设备的特性,如小屏幕、触摸事件和有限的网络带宽,进行性能优化。 通过这本书,读者不仅可以学习到HTML5的新特性,还能了解到如何将这些特性有效地应用于移动设备,为用户提供更好的浏览体验。此外,书中还包括调试和测试策略,确保开发者能够在各种移动平台上实现一致的性能和兼容性。
2018-08-31 上传
This book is based on modern OpenGL v3.3 and above. It covers a myriad of topics of interest ranging from basic camera models and view frustum culling to advanced topics, such as dual quaternion skinning and GPU based simulation techniques. The book follows the cookbook format whereby a number of steps are detailed showing how to accomplish a specific task and are later dissected to show how the whole technique works. The book starts with a gentle introduction to modern OpenGL. It then elaborates how to set up a basic shader application. Following this discussion, all shader stages are introduced using practical examples so that readers may understand how the different stages of the modern GPU pipeline work. Following the introductory chapter, a vector-based camera viewing model is presented with two camera types: target and free camera. In addition, we also detail how to carry out picking in modern OpenGL using depth buffer, color buffer, and scene intersection queries. In simulation applications and games in particular, skybox is a very useful object. We will detail its implementation in a simple manner. For reflective objects, such as mirrors and dynamic reflections, render-to-texture functionality using FBO and dynamic cube mapping are detailed. In addition to graphics, image processing techniques are also presented to implement digital convolution filters using the fragment shader, and basic transformation, such as twirl is also detailed. Moreover, effects such as glow are also covered to enable rendering of glowing geometry. Seldom do we find a graphics application without light. Lights play an important role in portraying the mood of a scene. We will cover point, directional, and spot lights with attenuation and both per-vertex and per-fragment approaches. In addition, shadow mapping techniques are also covered including support of percentage closer filtering (PCF) and variance shadow mapping. In typical applications, more complex mesh models are used which are stored in external model files modeled in a 3D modeling package. We elaborate two techniques for loading such models by using separate and interleaved buffer objects. Concrete examples are given by parsing 3DS and OBJ model formats. These model loaders provide support for most attributes, including materials. Skeletal characters are introduced by a new skeletal animation format (the EZMesh format). We will see how to load such models with animation using both matrix palette skinning and dual quaternion skinning. Wherever possible, the recipes also detail pointers to external libraries and web addresses for more information. Fuzzy objects, such as smoke are often used to add special effects. Such objects are typically handled using a particle system. We introduce a stateless and a state-preserving particle system in detail. When a scene with a high depth complexity is presented, normal alpha blending techniques fail miserably. Hence, approaches such as depth peeling are used to render the geometry in the correct depth order with correct blending. We will take a look at the implementation of both the conventional front-to-back depth peeling as well as the more recent dual depth peeling approach. All steps needed in the process are detailed. With computer graphics, we are always pushing the limits of hardware to get a true life-like rendering. Lighting is one thing that can convincingly represent such a depiction. Unfortunately however, normal everyday lighting is impossible to simulate in real-time. The computer graphics community has developed various approximation methods for modeling of such lighting. These are grouped under global illumination techniques. The recipes elaborate two common approaches, spherical harmonics and screen space ambient occlusion, on the modern GPU. Finally, we present two additional methods for rendering scenes, namely, ray tracing and path tracing. Both of these methods have been detailed and implemented on the modern GPU. Computer graphics have influenced several different fields ranging from visual effects in movies to biomedical and engineering simulations. In the latter domain in particular, computer graphics and visualization methods have been widely adopted. Modern GPUs have tremendous horsepower, which can be utilized for advanced visualization methods, and volume rendering is one of them. We will take a look at several algorithms for volume rendering, namely view-aligned 3D texture slicing, single-pass GPU ray casting, pseudo-isosurface rendering, splatting, polygonal isosurface extraction using the Marching Tetrahedra algorithm, and half-angle slicing method for volumetric lighting. Physically-based simulations are an important class of algorithms that enable us to predict the motion of objects through approximations of the physical models. We harness the new transform feedback mechanism to carry out two physically-based simulations entirely on the GPU. We first present a model for cloth simulation (with collision detection and response) and then a model for particle system simulation on the modern GPU. In summary, this book contains a wealth of information from a wide array of topics. I had a lot of fun writing this book and I learned a lot of techniques on the way. I do hope that this book serves as a useful resource for others in the years to come.