Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 280 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
280
Dung lượng
10,98 MB
Nội dung
[...]... many years and being used to working with high-performance programming languages and hardware, I initially had modest expectations of graphics programming withJavaScript What I actually found was an excellent and efficient programming language that is continually being leveraged with better browsers, performance enhancements, and exciting new facilities Combined with features such as Canvas, JavaScript. .. as Flash Subjects covered include collision detection and object handling We’ll also develop a full retro-style arcade game to illustrate in action the techniques we’ve discussed Chapter 6, HTML5Canvas Examines the Canvas element in depth, with numerous examples—including how to develop a graphical chat application using Canvasand WebSockets Canvas topics include an introduction to basic drawing,... sign, where 0 means positive and 1 means negative Go through the same procedure again, and we are back to +69 JavaScript s bitwise operators JavaScript s bitwise operators act on the binary digits, or bits, within an integer number Bitwise AND (x & y) This performs a binary AND on the operands, where the resultant bit will be set only if the equivalent bit is set in both operands So, 0x0007 & 0x0003 gives... plug-ins such as Adobe Flash, and features such as WebGL ensure a very bright future for graphics programming using JavaScriptand a browser This book is for those who have a good working knowledge of JavaScriptand would like to experiment with graphics programming that goes beyond simple hover effects or relying purely on the animation facilities of libraries such as jQuery Within these pages, I cover... such as C++ and Java, int and float types are not explicitly declared This is a surprising omission, and a legacy of JavaScript s early years as a simple language intended for web designers and amateurs JavaScript s single number type does help you avoid many numeric type errors However, integers are fast, CPU-friendly, and the preferred choice for many programming tasks in other languages JavaScript s... exploration of the subjects covered Experiment and have fun! ix Audience and Assumptions Readers of this book should have a good working knowledge of creating websites and web applications and in particular, the use of JavaScript I like jQuery because it speeds up development, and many of the code samples include this library by default In general, any external libraries and associated files are included from... interactive and animated mobile experience This chapter covers the development of a graphical sliding puzzle game specifically geared to the jQuery UI and mobile devices Chapter 10, Creating Android Apps with PhoneGap Want to create a native mobile application using your usual web development skills? PhoneGap comes to the rescue This chapter explains how to install and configure PhoneGap to create native Android... Books Online is an on-demand digital library that lets you easily search over 7,500 technology and creative reference books and videos to find the answers you need quickly With a subscription, you can read any page and watch any video from our library online Read books on your cell phone and mobile devices Access new titles before they are Preface | xiii available for print, and get exclusive access... is an OOP language at all (it is) Despite JavaScript s apparent syntactic resemblance to class-based OOP languages like C++ and Java, there is no Class statement (or equivalent) in JavaScript, nor any obvious way to implement popular OOP methodologies such as inheritance (code reuse) and encapsulation JavaScript is also very loosely typed, with no compiler, and hence offers very few errors or warnings... unsuspecting programmers a huge amount of freedom on one hand, and a mile of rope with which to hang themselves on the other Programmers coming from more classic and strictly defined languages can be frustrated by JavaScript s blissful ignorance of virtually every programming faux pas imaginable: global functions and variables are the default behavior, and missing semicolons are perfectly acceptable (remember . 130
Drawing Paths with Lines and Curves 130
Drawing Bitmap Images 138
Colors, Strokes, and Fills 140
Animating with Canvas 144
Canvas and Recursive Drawing. or Both? 124
Canvas Limitations 125
Canvas Versus SVG 125
Canvas Versus Adobe Flash 126
Canvas Exporters 127
Canvas Drawing Basics 129
The Canvas Element