文件名称:实例绘制曲线。-HTML 5高级移动开发 Canvas画布PPT教程
文件大小:762KB
文件格式:PPT
更新时间:2024-05-13 05:50:34
HTML5 Canvas
实例:绘制曲线。 var canvas = document.getElementById("myCanvas"); var context = canvas.getContext("2d"); var centerX = 288; var centerY = 160; var radius = 75; var startingAngle = 1.1 * Math.PI; var endingAngle = 1.9 * Math.PI; var counterclockwise = false; context.arc(centerX, centerY, radius, startingAngle, endingAngle, counterclockwise); context.lineWidth = 15; context.strokeStyle = "black"; // line color context.stroke(); Math.PI表示180度。 *