官术网_书友最值得收藏!

  • 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().

主站蜘蛛池模板: 绥德县| 武宁县| 海盐县| 宁波市| 伊吾县| 成都市| 内丘县| 增城市| 嘉义市| 开封县| 丁青县| 玉环县| 湄潭县| 武乡县| 清新县| 庆阳市| 长岛县| 绍兴市| 嵊州市| 金湖县| 澳门| 新巴尔虎右旗| 芜湖市| 安岳县| 新营市| 托克托县| 福州市| 盐城市| 泰来县| 讷河市| 阳朔县| 济宁市| 珠海市| 托克托县| 柞水县| 开封县| 石景山区| 长丰县| 会泽县| 屏南县| 屏东市|