Preview:
// got DOM element

const cursor = document.querySelector('#cursor');

const cursorCircle = cursor.querySelector('.cursor__circle');

​

//variables which defines coordinates of 

const mouse = { x: -0, y: -100 }; // mouse pointer's coordinates

const pos = { x: 0, y: 0 }; // cursor's coordinates

const speed = 0.1; // between 0 and 1

​
10
const updateCoordinates = e => {

  mouse.x = e.clientX;
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter