MCPcopy Create free account
hub / github.com/codemistic/Web-Development / eyeball

Function eyeball

Animated Eye moving with cursor/script.js:3–13  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1document.querySelector("body").addEventListener("mousemove", eyeball);
2
3function eyeball() {
4 'use strict';
5 var eye = document.querySelectorAll(".eye");
6 eye.forEach(function (eye) {
7 let x = (eye.getBoundingClientRect().left) + (eye.clientWidth / 2)
8 let y = (eye.getBoundingClientRect().top) + (eye.clientHeight / 2);
9 let radian = Math.atan2(event.pageX - x, event.pageY - y);
10 let rot = (radian * (180 / Math.PI) * -1) + 270;
11 eye.style.transform = "rotate("+ rot +"deg)"
12 })
13}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected