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

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

主站蜘蛛池模板: 开阳县| 桃园市| 固镇县| 桐梓县| 钦州市| 六枝特区| 永新县| 诏安县| 钦州市| 安塞县| 黄平县| 麻江县| 和硕县| 三亚市| 茂名市| 明光市| 桃江县| 临沂市| 施秉县| 成都市| 大丰市| 新泰市| 清河县| 田阳县| 德令哈市| 思南县| 高密市| 乐山市| 兴义市| 横峰县| 诏安县| 盐城市| 凉城县| 于都县| 沙坪坝区| 札达县| 木里| 天台县| 县级市| 楚雄市| 昌江|