珠f基于Vue+Vuex实战打造QQ音乐WebApp
window.onload = function(){//页面加载时执行
const canvas = document.getElementById('canvas')
canvas.width = 800 //设置画布的宽度
canvas.height = 800 //设置画布的高度
const ctx = canvas.getContext('2d') //创建2d的上下文绘制环境
for(let piece of tangram){ //遍历,取出tangram数组中的每一个对象
//console.log(piece)
draw(piece,ctx) //调用draw函数
}
}