图书介绍

HTML5 Canvas 网站本地化交互和动画设计 原书第2版 英文【2025|PDF|Epub|mobi|kindle电子书版本百度云盘下载】

HTML5 Canvas 网站本地化交互和动画设计 原书第2版 英文
  • (美)富尔顿著 著
  • 出版社: 南京:东南大学出版社
  • ISBN:9787564146009
  • 出版时间:2014
  • 标注页数:730页
  • 文件大小:239MB
  • 文件页数:750页
  • 主题词:超文本标记语言-程序设计-英文

PDF下载


点此进入-本书在线PDF格式电子书下载【推荐-云解压-方便快捷】直接下载PDF格式图书。移动端-PC端通用
种子下载[BT下载速度快]温馨提示:(请使用BT下载软件FDM进行下载)软件下载地址页直链下载[便捷但速度慢]  [在线试读本书]   [在线获取解压码]

下载说明

HTML5 Canvas 网站本地化交互和动画设计 原书第2版 英文PDF格式电子书版下载

下载的文件为RAR压缩包。需要使用解压软件进行解压得到PDF格式图书。

建议使用BT下载工具Free Download Manager进行下载,简称FDM(免费,没有广告,支持多平台)。本站资源全部打包为BT种子。所以需要使用专业的BT下载软件进行下载。如BitComet qBittorrent uTorrent等BT下载工具。迅雷目前由于本站不是热门资源。不推荐使用!后期资源热门了。安装了迅雷也可以迅雷进行下载!

(文件页数 要大于 标注页数,上中下等多册电子书除外)

注意:本站所有压缩包均有解压码: 点击下载压缩包解压工具

图书目录

1.Introduction to HTML5 Canvas1

What Is HTML5?2

The Basic HTML5 Page3

<!doctype html>3

<htmllang="en">4

<meta charset="UTF-8">4

<title>…</title>4

A Simple HTML5 Page4

Basic HTML We Will Use in This Book5

<div>5

<canvas>7

The Document Object Model (DOM)and Canvas7

JavaScript and Canvas7

Where Does JavaScript Go and Why?8

HTML5 Canvas"Hello World!"8

Encapsulating Your JavaScript Code for Canvas9

Adding Canvas to the HTML Page10

Using the document Object to Reference the Canvas Element in JavaScript11

Testing to See Whether the Browser Supports Canvas11

Retrieving the 2D Context12

The drawScreen() Function12

Debugging with console.log16

The 2D Context and the Current State17

The HTML5 Canvas Object18

Another Example:Guess The Letter19

How the Game Works20

The"Guess The Letter"Game Variables20

The initGame() Function21

The eventKeyPressed() Function21

The drawScreen()Function23

Exporting Canvas to an Image24

The Final Game Code25

Hello World Animated Edition25

Some Necessary Properties26

Animation Loop27

Alpha Transparency with the globalAlpha Property28

Clearing and Displaying the Background28

Updating the globalAlpha Property for Text Display29

Drawing the Text29

HTML5 Canvas and Accessibility:Sub Dom31

Hit Testing Proposal32

What's Next?33

2.Drawing on the Canvas35

The Basic File Setup for This Chapter35

The Basic Rectangle Shape36

The Canvas State37

What's Not Part of the State?38

How Do We Save and Restore the Canvas State?38

Using Paths to Create Lines38

Starting and Ending a Path39

The Actual Drawing39

Examples of More Advanced Line Drawing40

Advanced Path Methods42

Arcs42

Bezier Curves44

The Canvas Clipping Region45

Compositing on the Canvas47

Simple Canvas Transformations50

Rotation and Translation Transformations50

Scale Transformations56

Combining Scale and Rotation Transformations57

Filling Objects with Colors and Gradients60

Setting Basic Fill Colors60

Filling Shapes with Gradients61

Filling Shapes with Patterns71

Creating Shadows on Canvas Shapes75

Methods to Clear the Canvas77

Simple Fill77

Resetting the Canvas Width and Height77

Resetting the Canvas clearRect Function77

Checking to See Whether a Point Is in the Current Path79

Drawing a Focus Ring80

What's Next?80

3.The HTML5 Canvas Text API81

Canvas Text and CSS81

Displaying Basic Text82

Basic Text Display82

Handling Basic Text in Text Arranger82

Communicating Between HTML Forms and the Canvas83

Using measure Text84

fill Text and stroke Text85

Setting the Text Font89

Font Size,Face,Weight,and Style Basics89

Handling Font Size and Face in Text Arranger89

Font Color94

Font Baseline and Alignment96

Text Arranger Version 2.0101

Text and the Canvas Context101

Global Alpha and Text101

Global Shadows and Text103

Text with Gradients and Patterns106

Linear Gradients and Text107

Radial Gradients and Text109

Image Patterns and Text109

Handling Gradients and Patterns in Text Arranger110

Width,Height,Scale,and to Data URL()Revisited114

Dynamically Resizing the Canvas114

Dynamically Scaling the Canvas116

The to Data URL() Method of the Canvas Object117

Final Version of Text Arranger119

Animated Gradients128

The Future of Text on the Canvas132

CSS Text133

Making Text Accessible133

What's Next?133

4.Images on the Canvas135

The Basic File Setup for This Chapter135

Image Basics136

Preloading Images137

Displaying an Image on the Canvas with drawImage()137

Resizing an Image Painted to the Canvas139

Copying Part of an Image to the Canvas140

Simple Cell-Based Sprite Animation142

Creating an Animation Frame Counter143

Creating a Timer Loop143

Changing the Tile to Display143

Advanced Cell-Based Animation145

Examining the Tile Sheet145

Creating an Animation Array145

Choosing the Tile to Display146

Looping Through the Tiles146

Drawing the Tile147

Moving the Image Across the Canvas148

Applying Rotation Transformations to an Image149

Canvas Transformation Basics150

Animating a Transformed Image153

Creating a Grid of Tiles155

Defining aTile Map155

Creating a Tile Map with Tiled156

Displaying the Map on the Canvas158

Diving into Drawing Properties with a Large Image161

Creating a Window for the Image162

Drawing the Image Window162

Changing the ViewPort Property of the Image164

Changing the Image Source Scale166

Panning to a Spot on the Source Image167

Pan and Scale in the Same Operation168

Pixel Manipulation170

The Canvas Pixel Manipulation API170

Application Tile Stamper172

Copying from One Canvas to Another179

Using Pixel Data to Detect Object Collisions182

The Colliding Objects183

How We Will Test Collisions184

Checking for Intersection Between Two Objects184

What's Next?190

5.Math,Physics,and Animation191

Moving in a Straight Line191

Moving Between Two Points:The Distance of a Line194

Moving on a Vector199

Bouncing Off Walls204

Bouncing a Single Ball205

Multiple Balls Bouncing Off Walls208

Multiple Balls Bouncing with a Dynamically Resized Canvas214

Multiple Balls Bouncing and Colliding219

Multiple Balls Bouncing with Friction233

Curve and Circular Movement239

Uniform Circular Motion239

Moving in a Simple Spiral243

Cubic Bezier Curve Movement245

Moving an Image251

Creating a Cubic Bezier Curve Loop255

Simple Gravity,Elasticity,and Friction259

Simple Gravity260

Simple Gravity with a Bounce263

Gravity with Bounce and Applied Simple Elasticity266

Simple Gravity,Simple Elasticity,and Simple Friction270

Easing273

Easing Out(Landing the Ship)273

Easing In(Taking Off)277

Box2D and the Canvas281

Downloading Box2dWeb281

How Does Box2dWeb Work?281

Box2D Hello World282

Including the Library282

Creating a Box2dWeb World282

Units in Box2dWeb283

Defining the Walls in Box2D284

Creating Balls285

Rendering b2debugDraw vs.Canvas Rendering286

drawScreen()287

Bouncing Balls Revisited289

Translating to the Canvas290

Interactivity with Box2D293

Creating the Boxes294

Rendering the Boxes295

Adding Interactivity296

Creating Boxes296

Handling the Balls297

Box2D Further Reading303

What's Next?303

6.Mixing HTML5 Video and Canvas305

HTML5 Video Support305

Theora+Vorbis=.ogg305

H.264+$$$=.mp4306

VP8+Vbrbis=.webm306

Combining All Three307

Converting Video Formats307

Basic HTML5 Video Implementation308

Plain-Vanilla Video Embed309

Video with Controls,Loop,and Autoplay311

Altering the Width and Height of the Video312

Preloading Video in JavaScript317

Video and the Canvas321

Displaying a Video on HTML5 Canvas321

HTML5 Video Properties327

Video on the Canvas Examples331

Using the currentTime Property to Create Video Events331

Canvas Video Transformations:Rotation335

Canvas Video Puzzle341

Creating Video Controls on the Canvas355

Animation Revisited:Moving Videos364

Capturing Video with JavaScript369

Web RTC Media Capture and Streams API370

Example 1:Show Video370

Example 2:Put Video on the Canvas and Take a Screenshot373

Example 3:Create a Video Puzzle out of User-Captured Video376

Video and Mobile378

What's Next?379

7.Working with Audio381

The Basic<audio>Tag381

Audio Formats382

Supported Formats382

Audacity382

Example:Using All Three Formats384

Audio Tag Properties,Functions,and Events385

Audio Functions385

Important Audio Properties385

Important Audio Events386

Loading and Playing the Audio387

Displaying Attributes on the Canvas388

Playing a Sound with No Audio Tag391

Dynamically Creating an Audio Element in JavaScript392

Finding the Supported Audio Format393

Playing the Sound394

Look Ma,No Tag!395

Creating a Canvas Audio Player397

Creating Custom User Controls on the Canvas398

Loading the Button Assets399

Setting Up the Audio Player Values400

Mouse Events401

Sliding Play Indicator402

Play/Pause Push Button:Hit Test Point Revisited403

Loop/No Loop Toggle Button406

Click-and-Drag Volume Slider406

Case Study in Audio:Space Raiders Game416

Whv Sounds in Apps Are Different:Event Sounds416

Iterations416

Space Raiders Game Structure417

Iteration#1:Playing Sounds Using a Single Object426

Iteration#2:Creating Unlimited Dynamic Sound Objects427

Iteration#3:Creating a Sound Pool429

Iteration#4:Reusing Preloaded Sounds431

Web Audio API435

What Is the Web Audio API?436

Space Raiders with the Web Audio API Applied436

What's Next?439

8.Canvas Games:PartⅠ441

Whv Games in HTML5?441

Canvas Compared to Flash442

What Does Canvas Offer?442

Our Basic Game HTML5 File442

Our Game's Design444

Game Graphics:Drawing with Paths444

Needed Assets445

Using Paths to Draw the Game's Main Character445

Animating on the Canvas448

Game Timer Loop448

The Player Ship State Changes449

Applying Transformations to Game Graphics451

The Canvas Stack451

Game Graphic Transformations453

Rotating the Player Ship from the Center453

Alpha Fading the Player Ship455

Game Object Physics and Animation456

How Our Player Ship Will Move456

Controlling the Player Ship with the Keyboard458

Giving the Player Ship a Maximum Velocity462

A Basic Game Framework463

The Game State Machine463

The Update/Render(Repeat)Cycle467

The FrameRateCounter Object Prototype469

Putting It All Together471

Geo Blaster Game Structure471

Geo Blaster Global Game Variables475

The Player Object476

Geo Blaster Game Algorithms477

Arrays of Logical Display Objects477

Level Knobs479

Level and Game End480

Awarding the Player Extra Ships481

Applying Collision Detection481

The Geo Blaster Basic Full Source483

Rock Object Prototype484

Simple A Path Finding on a Tile Grid486

What Is A?486

A Applied to a Larger Tile Map493

A Taking Diagonal Moves into Account498

A with Node Weights502

A with Node Weights and Diagonals506

Moving a Game Character Along the A Path514

Tanks That Pass Through Walls?518

What's Next?528

9.Canvas Games:PartⅡ529

Geo Blaster Extended529

Geo Blaster Tile Sheet530

Rendering the Other Game Objects535

Adding Sound541

Pooling Object Instances546

Adding a Step Timer548

Creating a Dynamic Tile Sheet at Runtime550

A Simple Tile-Based Game555

Micro Tank Maze Description556

The Tile Sheet for Our Game556

The Playfield558

The Player559

The Enemy560

The Goal561

The Explosions561

Turn-Based Game Flow and the State Machine562

Simple Tile Movement Logic Overview566

Rendering Logic Overview568

Simple Homegrown AI Overview569

Micro Tank Maze Complete Game Code570

Scrolling a Tile-Based World570

First,a Tile Sheet That Contains the Tiles We Want to Paint to the Screen570

Second,a Two-Dimensional Array to Describe Our Game World571

Third,Paint the Tile-Based World to the Canvas571

Coarse Scrolling vs.Fine Scrolling572

The Camera Object572

The World Object573

Fine Scrolling the Row and Column Buffers574

Coarse Scrolling Full Code Example580

Fine Scrolling Full Code Example585

What's Next?589

10.Going Mobile!591

The First Application591

The Code592

Examining the Code for BSBingo.html597

The Application Code600

Scaling the Game for the Browser601

Testing the Game on an Actual Device606

Retro Blaster Touch607

Mobilizing Retro Blaster Touch610

Jumping to Full Screen610

Touch Move Events612

Retro Blaster Tcuch Complete Game Code618

Beyond the Canvas619

What's Next?619

11.Further Explorations621

3D with WebGL621

What Is WebGL?621

How Does One Test WebGL?622

How Do I Learn More About WebGL?622

What Does a WebGL Application Look Like?623

Further Explorations with WebGL628

WebGL JavaScript Libraries629

Multiplayer Applications with ElectroServer 5630

Installing ElectroServer631

The Basic Architecture of a Socket-Server Application634

The Basic Architecture of an ElectroServer Application634

Creating a Chat Application with ElectroServer636

Testing the Application in Google Chrome641

Further Explorations with ElectroServer642

This Is Just the Tip of the Iceberg645

Creating a Simple Object Framework for the Canvas646

Creating the Drag-and-Drop Application646

Application Design647

Windows 8 Apps and the HTML5 Canvas659

What's Next in HTML5.1 and Canvas Level 2?663

HTML5.1 Canvas Context663

Canvas Level-2664

Conclusion664

A.Full Code Listings667

Index711

热门推荐