Canvas images and Click event

后端 未结 5 1341
隐瞒了意图╮
隐瞒了意图╮ 2020-12-18 15:41

I have currently two circles in a tag with HTML5 & JavaScript.

Now I\'m trying to add an image (done) that changes based on mouse-ove

5条回答
  •  生来不讨喜
    2020-12-18 16:34

    Well The simple answer is you can't. You either will have to find the coordinates of the click event and calculate whether you want to perform an option or not or you can use area and map tags and overlay the canvas element with it. To change a canvas use the clearRect function to draw paint a rectangle over everything and then redraw what you want.

提交回复
热议问题