Pavle Stojanovic Pavle Stojanovic - 13 days ago 6
Java Question

Make an eyeball move from a static image

Not sure where or how to start, I have the 'like a sir' meme and have placed it on a single webpage http://mr-sir.duckdns.org/

what I want is when the visitor comes and moves around the cursor for the eyeball to move around ?

do I have to make a GIF out of the image first (I recently started using Linux Mint and it has GIMP so I want to make to most of it), then

do what with the java code (I found a stackoverflow link to a question and answer for sample to move an eye ball but its not specific) so not sure ?

btw its my first project to do in Java and using Linux.

Answer

You can achieve that by using a div above the eye, that div would have his border-radius to 50%, to be a ball or something looking like an eye. Then, you need to track the X and Y position of the mouse, and just use transform: translate(X_amount, Y_amount); on that div (the ball). So, you need html, css and js, nothing more. Maybe a package for tracking the mouse position if you can't code it by yourself