RamShankarKumar / eyeball_tracking_mouse_cursor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

eyeball_tracking_mouse_cursor

This was a very fun project to do as I leaned a lot of new things in JavaScript that I did not even know those exists. In this project I have created a face with two eyes that always keeps looking at the position of mouse curser or in simple work this face will keep stating on your mouse cursor wherever you position your mouse curser.

What did I learn from this project ?

  1. getBoundingClientRect() --> This method returns a "DOMRect" object providing information about the size of an element and its position relative to the viewport. This is the one function that inspired me to create this project.
  2. atan2() function -> With help of this function we find angle between two DOM element in JavaScript with help of basic trignometric concept.
  3. requestAnimationFrame() function for smooth animation. I have to learn more about this function so that I can put this in more usecases.
  4. Setting CSS property dynamically using JavaScript variables.

Try it here

https://ramshankarkumar.github.io/eyeball_tracking_mouse_cursor/

About


Languages

Language:JavaScript 47.9%Language:CSS 37.3%Language:HTML 14.8%