var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
function setImage() {
var pixelRatio = 5;
canvas.width = 4 * pixelRatio;
canvas.height = 4 * pixelRatio;
// 创建渐变圆
var grd = context.createRadialGradient(2 * pixelRatio, 2 * pixelRatio, 0, 2 * pixelRatio, 2 * pixelRatio, 2 * pixelRatio);
grd.addColorStop(0, "#32C5FF");
grd.addColorStop(0.8, "#37acd38c");
grd.addColorStop(1, "#37acd300");
context.beginPath();
context.arc(2 * pixelRatio, 2 * pixelRatio, 2 * pixelRatio, 0, 2 * Math.PI);
context.fillStyle = grd;
context.fill();
context.strokeStyle = '#ffffff00';
context.stroke();
// 画圆
context.beginPath();
context.arc(2 * pixelRat
canvas绘制点样式
最新推荐文章于 2024-06-30 12:42:30 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)