Home  >  Article  >  Web Front-end  >  html5, can collision be detected? _html/css_WEB-ITnose

html5, can collision be detected? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:14:44840browse

1. I used html5 to randomly draw a few thick lines with fixed color types.
2. Can you tell whether the mouse has moved above the line?


Reply to the discussion (solution)

The drawn line must have some base points. Use mathematical knowledge to determine whether the event.X and event.Y of the mouse are on the line

This is okay, but can it determine the color at the current position of the mouse?

If it is the same color as the line, then it is judged that it is on the line. Is this okay?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn