Awesome you know I subscribe to your channel and clicked the notification bill after I see this video and find the source code in the description I will explore your channel now. We need a wonderful avideos like that
I dont know if you read this, but why you do the clientX * 100 and the / innerwidth??? Why multiple 100 and divide with the width and height?? And in the last sentence. There is transform, but what means (-"+×+", -(+y+)" what means - and +. 👍
Can you please tell, as balls was a variable before, in the script but inside loop why we used it as an array and why did you used a for loop till 2, what does that means i didn't get the meaning.
bro the getelementsbyclassname() return an array of elements i have two div with class 'ball' so the first element was in the index 0 and the second was in the index 1
Hello, i tried to use id='ball' instead of class='ball' and use document.getElementById('ball'). Other than this, everything is the same with the video. Unfortunately it doesn't work. Would anyone can explain?
May I know what code editor are you using? It automatically shows the changes on your code, is this something included or a feature of the code editor? Thanks!
Assume you have a viewport width of 1000px and you move your mouse to 100px along the X axis. By using the formula "x = mouse-x-coordinate * 100 / viewport-width" you obtain 10px as the result. If you treat the result as percentage instead, you can translate (move) the eye balls in their parent container along the x-axis according to that percentage - 0% meaning all the way to the left, 100% all the way to the right.
Can anyone help me out? I want to achive this effect but with a picture, I understand I have to make eyeballs as separate elements but the problem I am having is that they don't want to stick to eye position on a website. How can I assign them to be in the exact same location on any screen?
Thank your for this great video. I used it. Now it works fine, only one thing. My character is always looking away from my cursor, always the opposite direction, why is that?
When I tried it seeing your video, I got an error which says "event isn't defined". I copied your code. But when I run it on my browser, it returns the same report. I don't understand that how to define the event. Please help me bro...