SitePoint Sponsor

User Tag List

Results 1 to 20 of 20
  1. #1
    SitePoint Evangelist
    Join Date
    May 2002
    Location
    Barcelona, Spain
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    cursor following eyes

    Apologies if this has already been asked, but I want to create a couple of eyes that follow the mouse wherever it moves on the whole web page. I have a gif image of a funky animal that has relatively big eyes, I want his pupils to move following the mouse around the page.

    Any help is REALLY appreciated.
    Thanks
    Used to prefer PHP.
    Now I prefer Maya but stuck with PHP
    bruji.com

  2. #2
    SitePoint Evangelist dalangalma's Avatar
    Join Date
    Aug 2002
    Posts
    468
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Get the mouse position from _xmouse and _ymouse, then move the eyes towards that position.
    Web Design:
    http://www.numbera.com/
    Free Web Design Resources and Software:
    http://brh.numbera.com/

  3. #3
    SitePoint Guru MG315's Avatar
    Join Date
    Mar 2003
    Location
    Houston, Texas
    Posts
    758
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    eyes._x = _xmouse;
    eyes._y = _ymouse;

  4. #4
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol...you can't be serious...
    Aaron Brazell
    Technosailor



  5. #5
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MG315
    eyes._x = _xmouse;
    eyes._y = _ymouse;
    If I am reading this correctly, you want the pupils to follow the mouse not the actual set of eyes. That will take some math calculations to detect the angle in relation to the mouse movement. Can you clarify.


    lol...you can't be serious...
    Well there are some who still use flash for silly animations.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  6. #6
    SitePoint Guru MG315's Avatar
    Join Date
    Mar 2003
    Location
    Houston, Texas
    Posts
    758
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry, i read it wrong. i thought you wanted the eyes to be attached to the mouse...

  7. #7
    SitePoint Evangelist
    Join Date
    May 2002
    Location
    Barcelona, Spain
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by freddydoesphp
    Can you clarify.
    Well there are some who still use flash for silly animations.
    That is correct. I want the pupils to follow the mouse, not the actual set of eyes. I need the critter to always be looking at the mouse.

    As for it being a silly animation... a couple of things:

    1. Who's to say it's silly? It may be silly for you but it's not for my client who requested it.
    2. And, if it is silly, what's wrong with using Flash for silly animation? Is Flash so high and mighty and "royal" that it can only be used for "serious" animation (whatever that is). Where's the mandate that says: "thou shall use Flash only for Corporate Identification?" how boring.
    3. To me, this is a very interesting technical challenge and I'm excited about it. I'm also excited to be able to give the client what they want.

    As developers, it IS part of our job to stear the client in the right direction, keep him away from evil things like highlited or blinking text, bad design, bad color usage, etc. This little thing, I think is benign.

    Thanks for your help in advance. I don't think there's any way I can come up with the math to do this.
    Used to prefer PHP.
    Now I prefer Maya but stuck with PHP
    bruji.com

  8. #8
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    goto www.plasmapages.com and check the Harley-Davidson ads there. If this is what you want PM me.

  9. #9
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Woah, pata! I didn't mean your work was silly nor did I mean you were in the business of creating silly anything. I was actually kind of being sarcastic to Sketch's response above mine, as I have a feeling he still feels flash to be a product that really has no place on the web. I couldn't disagree more. No offense to you either Sketch if I was wrong.

    If you want me to show you the math for that just ask.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  10. #10
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No offense all the way around. I was under the impression we were talking about those javascript eyes that end up on all the cheapo kiddie websites.

    I, of course, feel Flash has it's place on the web but is an oft overused solution. But then...I don't want to go 'round with Golgotha again...

    /Monday Night Football theme music....
    Aaron Brazell
    Technosailor



  11. #11
    SitePoint Evangelist
    Join Date
    May 2002
    Location
    Barcelona, Spain
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No offense taken guys, just thought I'd express my views, is all. I don't have anyone to talk about this stuff with, so I figured you were a good audience

    Yes, freddy, please send me the math. Also, Sketch, if you think this can be done with javascript, even better, I never thought it could be. Javascript is preferable actually.
    Used to prefer PHP.
    Now I prefer Maya but stuck with PHP
    bruji.com

  12. #12
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Aaron Brazell
    Technosailor



  13. #13
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I take back everything I said before. Is this something you want to sit in a small flash movie in an html page? Flash has a hard time detecting where the mouse is when its not over the movie. So you may have to revert to javascript. Which we all know will be buggy at best in different browsers. Well actually it fares pretty well, just tested the majors and Mozilla is the only one choking.

    HOWEVER: like Sketch I find this sort of thing to be horribly annoying, just my view. So no offense and I know clients can ask for the weirdest things.


    So can you confirm did you want this sort of effect or something more like a stationary set of eyes on a flash site whose pupils rotate to the angle of the mouse?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  14. #14
    SitePoint Evangelist
    Join Date
    May 2002
    Location
    Barcelona, Spain
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by freddydoesphp
    So can you confirm did you want this sort of effect or something more like a stationary set of eyes on a flash site whose pupils rotate to the angle of the mouse?
    Hmmm. What I need is the pupils to rotate to the angle of the mouse, following it as it were. If Flash has a hard time finding out where the mouse is when it's not on the movie that might be a problem. Ideally I wanted a small flash movie inside an html page, yes. But it's just the home page of the site that will have this, so maybe I can make the whole are a flash movie (though that's probably a bad idea due to load times, etc.). Maybe javascript is the best way to go, and whichever browser can't handle it, they just don't get the eyes moving...?
    Used to prefer PHP.
    Now I prefer Maya but stuck with PHP
    bruji.com

  15. #15
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    such a small trivial effect is likely not worth dropping Flash into your site, IMO.

    but, I too have done some things I normally wouldn't simply because the client wanted it that way.

  16. #16
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It always amazes me that a client hires someone to do this stuff, but then always dictates what they want even if its against the recommendation of the professional. Its like why hire me at all. Its like the old, I want some pretty music on my site but I don't want flash. That one always gets me going.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  17. #17
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Golgotha now that my interest has been peaked, you mind showing me how to calculate that angle from the eyes to the mouse?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  18. #18
    SitePoint Evangelist
    Join Date
    May 2002
    Location
    Barcelona, Spain
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And then of course, the problem with javascript is that it doesn't work in all browsers. I was thinking it wouldn't work in pre 4's so no big deal, but it turns out that the link that Sketch sent only works in IE for Windows (so far). I tried it in Mozilla for OS X, and Safari (Konqueror code recompiled for OS X) and no go. So I guess I'm back to the Flash thing...
    Used to prefer PHP.
    Now I prefer Maya but stuck with PHP
    bruji.com

  19. #19
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm sure there's other versions. All I did was googled for javascript eyes.

    Aaron
    Aaron Brazell
    Technosailor



  20. #20
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Location
    Texas
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you an 80s child?
    http://www.80schildren.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •