<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
img{
position: absolute;
top: 0;
left: 0;
width: 750px;
}
canvas{
position: absolute;
top: 0;
left: 0;
}
</style>
</head>
<body>
<img src="img/a11.jpg"/>
<canvas id="canvas" width="750" height="420"></canvas>
<script type="text/javascript">
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
var img = document.querySelector("img");
function drawBig(x,y){
ctx.drawImage(img,x-25,y-25,50,50,x-50,y-50,100,100);
ctx.globalCompositeOperation = "destination-atop";
ctx.beginPath();
ctx.arc(x,y,50,0,Math.PI * 2,true);
ctx.fill();
}
canvas.onmousedown = function(){
canvas.onmousemove = function(e){
var ev = e || window.event;
ctx.clearRect(0,0,canvas.width,canvas.height);
drawBig(ev.clientX,ev.clientY);
}
}
</script>
</body>
</html>