我在 5.0 中运行此代码时遇到了问题,但在 3.3 中运行良好。我已经设置了所有东西,但仍然存在问题。我这样做是错误的吗?
<canvas width="1000" height="584">
<drawview width="200" height="300"
x="12"
y="12">
<handler name="onwidth">
this.redraw();
</handler>
<handler name="onheight">
this.redraw();
</handler>
<method name="redraw">
this.clear();
var roundness = 5;
this.beginPath();
this.moveTo(roundness, 0);
this.lineTo(this.width - roundness, 0);
this.quadraticCurveTo(this.width, 0, this.width, roundness);
this.lineTo(this.width, this.height - roundness);
this.quadraticCurveTo(this.width, this.height, this.width - roundness, this.height);
this.lineTo(roundness, this.height);
this.quadraticCurveTo(0, this.height, 0, this.height - roundness);
this.lineTo(0, roundness);
this.quadraticCurveTo(0, 0, roundness, 0);
this.closePath();
var g = this.createRadialGradient(-this.width * .5, -this.height *.5, .7, 1.5 * this.width, 1.5 * this.height, 0)
this.globalAlpha = 0;
g.addColorStop(0, 0x000000);
this.globalAlpha = 0.8;
g.addColorStop(1, 0xffffff);
this.setAttribute("fillStyle", g);
this.fill();
</method>
</drawview>
</canvas>