标签:arc clip doc color log get 半径 contex code
clip(),在画布内使用路径,只绘制该路径内所包含区域的图像,不会只路径外的图像。
var canvas = document.getElementById(‘canvas‘); var context = canvas.getContext(‘2d‘); context.arc(160,160,150,0,2*Math.PI); context.fillStyle = ‘#fff‘; context.fill(); context.clip(); context.fillStyle = ‘rgba(280,187,186,1)‘; context.fillRect(10,10,300,300);//显示半径为150的粉色圆
标签:arc clip doc color log get 半径 contex code
原文地址:http://www.cnblogs.com/cornlin/p/7658774.html