- Canvas Cookbook
- Bhushan Purushottam Joshi
- 128字
- 2021-07-16 11:03:16
Introduction
In this chapter, we will learn how to draw rectangles, triangles, circles, ellipses, and custom shapes. Also, we will learn to fill gradients, translation, rotation, and scaling to be applied on these shapes.
The recipe structure will be a bit different in this chapter. We will have the JavaScript code in a separate file and this file will be embedded in the HTML code at run-time. In the previous chapter, the complete recipe was in a single file (.html
file). However, in this chapter, a single recipe will comprise two different files:
- An HTML file
- A JavaScript file
Also, the can
(canvas
) and ctx
(context
) objects are created within the init()
function and the reference to ctx
(context
) is passed to the different functions called within init()
.
推薦閱讀
- 測試驅動開發:入門、實戰與進階
- Visual FoxPro程序設計教程
- PHP 7底層設計與源碼實現
- Learning Hunk
- Corona SDK Mobile Game Development:Beginner's Guide(Second Edition)
- ElasticSearch Cookbook(Second Edition)
- Instant Pygame for Python Game Development How-to
- 高質量程序設計指南:C++/C語言
- Unreal Engine Game Development Cookbook
- 虛擬現實:引領未來的人機交互革命
- HTML 5與CSS 3權威指南(第4版·上冊)
- jQuery權威指南
- Web應用程序設計:ASP
- 從零開始:Qt可視化程序設計基礎教程
- React Router Quick Start Guide