canvas-5-polyfill 是用来在 HTML 5 Canvas 上开发新特征的 Javascript polyfill 库。开发的新特征如:Path2D objects 和 ellipse() on CanvasRenderingContext2D。
用途示例:
<html> <head> <title>Test Canvas Polyfill</title> <script src='bower_components/canvas-5-polyfill/canvas.js' type='text/javascript'></script> </head> <body> <canvas id=ID width=500 height=500> <script type='text/javascript' charset='utf-8'> var ctx = document.getElementById('ID').getContext('2d'); var p = new Path2D(); p.moveTo(100, 10); p.lineTo(10, 100); ctx.strokeStyle = '#555'; ctx.lineWidth = 10; ctx.stroke(p); </script> </body> </html>