首先我们先要把图形打出来
<style>
div{
width: 10px;
height: 10px;
background: red;
position: absolute;
border-radius: 50%;
}
</style>
然后写出滑动鼠标事件向那个方向移动
<script>
document.onmousemove = function () {
var div = document.createElement('div');
var x = event.clientX;
var y = event.clientY;
div.style.left = x + "px";
div.style.top = y + "px";
document.body.appendChild(div);
}
</script>