code-server/packages/app/src/index.ts

11 lines
403 B
TypeScript
Raw Normal View History

2019-01-12 00:50:54 +07:00
const overlay = document.getElementById("overlay");
const logo = document.getElementById("logo");
if (overlay && logo) {
overlay.addEventListener("mousemove", (event) => {
const xPos = ((event.clientX - logo.offsetLeft) / 24).toFixed(2);
const yPos = ((logo.offsetTop - event.clientY) / 24).toFixed(2);
logo.style.transform = `perspective(200px) rotateX(${yPos}deg) rotateY(${xPos}deg)`;
});
}