Closed Bug 1369289 Opened 7 years ago Closed 4 years ago

使用虚线部分,画不出虚线

Categories

(Developer Documentation Graveyard :: API: HTML, defect, P5)

All
Other
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: cxw_446, Unassigned)

References

()

Details

:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: unspecified
 Technical Contact: 

:: Details

<!DOCTYPE HTML>
<html>
<header>
<script src="js/dashline.js" type="text/javascript"></script>
</header>
<body onload="march();">
<canvas id="tutorial14" width="200" height="200"></canvas>
</body>
</html>

dashline.js文件:
var ctx = document.getElementById('tutorial14').getContext('2d');
var offset = 0;

function draw() {
  ctx.clearRect(0,0, canvas.width, canvas.height);
  ctx.setLineDash([4, 2]);
  ctx.lineDashOffset = -offset;
  ctx.strokeRect(10,10, 100, 100);
}

function march() {
  offset++;
  if (offset > 16) {
    offset = 0;
  }
  draw();
  setTimeout(march, 20);
}
march();
MDN Web Docs' bug reporting has now moved to GitHub. From now on, please file content bugs at https://github.com/mdn/sprints/issues/ and platform bugs at https://github.com/mdn/kuma/issues/.
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.