首页 > canvas 如何判断所画线条经过给定的点?

canvas 如何判断所画线条经过给定的点?

如图,怎么判断所画的线是不是经过了所有星光呢?


这个可以吗:

context.isPointInPath(x, y)

Returns true if the given point is in the current path.

https://www.w3.org/TR/2dcontext/#drawing-paths-to-the-canvas

【热门文章】
【热门文章】