![](https://csdnimg.cn/release/download_crawler_static/10316064/bg10.jpg)
xiv
HTML5 Canvas For Dummies
Using Text Editors ......................................................................................... 31
Standard text editors ........................................................................... 31
Alternatives to standard text editors ................................................ 32
Saving HTML5 Canvas application les ............................................ 34
Using Code Debuggers .................................................................................. 35
Firefox Firebug ..................................................................................... 35
Firerainbow ........................................................................................... 37
Other browsers’ debugging tools ...................................................... 37
Part II: Drawing on Canvas ......................................... 39
Chapter 3: Creating Objects ....................................41
Positioning Objects on a Canvas ................................................................. 41
Dening a web page to hold your Canvas.........................................41
Dening your Canvas ........................................................................... 44
Absolute positioning ........................................................................... 47
Relative positioning ............................................................................. 48
Drawing Rectangles ....................................................................................... 50
Dening Object Attributes ............................................................................ 51
Colors .................................................................................................... 53
Gradients ............................................................................................... 56
Patterns ................................................................................................. 61
Transparency ....................................................................................... 64
Shadows ................................................................................................ 66
Clipping ................................................................................................. 68
Displaying Text .............................................................................................. 70
Font attributes ...................................................................................... 70
Text baseline ........................................................................................ 71
Text alignment......................................................................................74
Drawing Lines ................................................................................................. 76
Line attributes ...................................................................................... 77
Line caps ............................................................................................... 78
Line joins ............................................................................................... 78
Line construction ................................................................................. 78
Chapter 4: Enhancing Objects ..................................81
Drawing Multi-Sided Shapes ......................................................................... 81
Drawing Curves .............................................................................................. 85
Arcs ........................................................................................................ 85
Circles .................................................................................................... 89
Rounded corners ................................................................................. 92
Bezier curves ........................................................................................ 95
Quadratic curves ................................................................................. 97
Multi-segment curves ........................................................................ 100