为什么放大时HTML画布中的对象不显示

问题描述 投票:1回答:1

有人可以解释为什么画布内的绿色弧线没有显示。

到目前为止,我的进度是:https://jsfiddle.net/hxsbLtwj/3/

这里是绿色弧线的代码>

  context.beginPath();
  context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
  context.fillStyle = 'green';
  context.fill();
  context.lineWidth = 5;
  context.strokeStyle = '#003300';
  context.stroke();

[我想要实现的是在缩放窗口中显示绿色弧,就像上面'文本'和'图像'部分中发生的一样。

我正在使用库'AnythingZoomer2'https://css-tricks.com/examples/AnythingZoomer/index.php

有人可以解释为什么未显示画布内的绿色弧线。这是我到目前为止的进展:https://jsfiddle.net/hxsbLtwj/3/这是绿色弧上下文的代码。beginPath()...

javascript html canvas html5-canvas zoom
1个回答
0
投票

问题是您没有为小区域创建画布,这就是为什么它不起作用的原因,这里是有效的example或有效的代码段:

© www.soinside.com 2019 - 2024. All rights reserved.