Custom Cursor [js]

PHOTO EMBED

Fri Feb 16 2024 08:14:45 GMT+0000 (Coordinated Universal Time)

Saved by @homunculus #javascript

// 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;
content_copyCOPY

https://codepen.io/Omurbekovic/pen/gOEKEMP