直接解压,可改背景和透视范围,jquery版本2.1.3
c.globalCompositeOperation = 'destination-out'; c.fillStyle = gradient c.arc(mousePosition.x, mousePosition.y, flashlight_size.outside, 0, Math.PI * 2, false);//圆的画法
表示三行jquery代码完美pk这个效果,如下:
x = e.clientX; y = e.clientY + 40; $("#box2").css("background", "-webkit-gradient(radial," + x + " " + y + ",80," + x + " " + y + ",120,from(rgba(0, 0, 0, 0.1)),to(rgba(0, 0, 0, 1)))")