小编Kee*_*epq的帖子

Html5 Canvas方法isPointInPath仅确定最后一个对象

这里有一个例子.

var context=document.getElementById("canvas").getContext("2d");

//Red Box
context.beginPath();
context.fillStyle="Red";
context.rect(10,10,50,50);
context.fill();

//Pink circle
context.beginPath();
context.lineWidth="3";
context.fillStyle="Pink";
context.arc(250,250,50,0,Math.PI*2,false);
context.fill();
context.stroke();

context.font="1.2em Verdana";
context.fillStyle="Black";
context.fillText(context.isPointInPath(35,35),35,35);
context.fillText(context.isPointInPath(250,250),250,250);
Run Code Online (Sandbox Code Playgroud)

如果在没有beginPath的情况下编写所有检测到的对 如何识别画布上的对象或省略beginPath?

javascript html5 canvas

8
推荐指数
1
解决办法
3618
查看次数

标签 统计

canvas ×1

html5 ×1

javascript ×1