出版时间:2012-4 出版社:东南大学 作者:(美)弗里曼//罗布森 页数:573 字数:853000
Tag标签:无
内容概要
你想要创建动态的、交互的、富数据的、保持连接的网页。等等,网页?为什么不直接使用HMTL5来创建成熟的web应用?还有,为什么不使用那些现代技术来实现,它们早在支持移动设备的时候就已经支持你的桌面浏览器了?而且,你当然会希望使用所有最新的HTML5技术,比如地理定位、视频、二维制图、网络存储、工作线程等等,对不对?
这本由Eric Freeman、Elisabeth
Robson著的《深入浅出HTML5编程(影印版)》就是你的特快车票,它可以带你学习如何使用今天的标准同时也会是明日的最佳实践来搭建Web应用。同时,你会在《深入浅出HTML5编程(影印版)》中了解HTML5的新API的基本知识,甚至你还会弄明白这些API是如何与你的网页进行交互,JaVaScript如何为它们提供动力,以及你如何使用它们来搭建能够打动你的老板并且吸引你的朋友的Web应用。
作者简介
作者:(美国)弗里曼(Eric Friiman) (美国)罗布森(Elisabdth Robson)
书籍目录
Intro
Getting to know HTML5: Welcome to Webville
IntroducingJavaScript and the DOM: A Little Code
Events, Handle and All That Jazz: A Little Interactiviy
JavaScript Functio and Objects: Serious JavaScript
Making Your HTML Location Aware: Geolocation
Talking to The Web: Extroverted Apps
Bringing Out Your Inner Artist: Canvas
Not Your Father's TV: Video... With Special Guest Star "Canvas"
Storing Things Locally: Web Storage
PuttingJavaScript to Work: Web Worke
Appendix: Top Ten Topics (We Didn't Cover)
Index
章节摘录
版权页: 插图: Canvas is an element you place in your page to create a drawing space. The canvas has no default style or content until you provide it (so you won't see it on the page until you draw something in it or add a border with CSS). You can have more than one canvas on your page.Of course,you'll need to give each one a unique id to access each using JavaScript. To specify the size of the canvas element,use the width and height attributes on the element. Everything you put in canvas is drawn using JavaScript. To draw on the canvas,you first need to create a context.Currently,a 2D context is your only option,although other context types may exist in the future. A context is needed to draw in the canvas because it provides a specific kind of interface (e.g.,2D versus 3D).You'll be able to choose from more than one kind ofinterface to draw on a canvas. You access the canvas by using context properties and methods. To draw a rectangle in the canvas,use the context.fillRect method.This creates a rectangle filled with color. To create a rectangle outline,use strokeRect instead of tlIIRect. Use flIIStyle and strokeStyle to change the default fill and stroke color,which is black. You can specify colors using the same format as you use with CSS (e.g.,"black","#000000 ,"rgb(0,0,0)".Remember to put quotes around the value of the fillStyle. There is no fiIICircle method.To draw a circle in canvas,you need to draw an arc. To create arbitrary shapes or arcs,you first need to create a path. A path is a invisible line or shape you create that defines a line or area on the canvas.You can't see the path until you stroke or fill it. To create a triangle,create a path using beginPath,then use moveTo and lineTo to draw the path.Use closePath to join two points on the path. To draw a circle,create an arc that is 360 degrees.Your start angle is 0,and your end angle is 360 degrees. Angles are specified in canvas using radians,not degrees,so you need to convert from degrees to radians to specify your start and end angles. 360 degrees=2Pi radians. To draw text in canvas,use the fillText method. When you draw text in canvas,you need to specify the position,style,and other properties using context properties. When you set a context property,it applies to all the drawing that follows until you change the property again.For example,changing the fillStyle will affect the color of shapes and text you draw after setting the fillStyle. Add an image to your canvas with the drawlmage method. To add an image,you first need to create an image object and make sure it's completely loaded. Drawing on canvas is like doing "bitmap" drawing in graphics programs.
编辑推荐
《深入浅出HTML5编程(影印版)(英文)》编辑推荐:我们认为你的时间如此宝贵以至于不应该花费在为新概念伤脑筋上面。这本由Eric Freeman、Elisabeth Robson著,运用最新的认知科学和学习理论打造多感官的学习体验,运用适合大脑工作方式的直观的格式编排,而不是令人昏昏欲睡的密密麻麻的文字。
图书封面
图书标签Tags
无
评论、评分、阅读与下载