Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8126251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:05:25+00:00 2026-06-06T07:05:25+00:00

Something I’ve wanted to learn for quite a time now, but haven’t been able

  • 0

Something I’ve wanted to learn for quite a time now, but haven’t been able to figure out.

http://jsfiddle.net/Mobilpadde/Xt7ag/

Then you move the mouse, it follows, which is the easy part, but I want to rotate too, like always look in the direction of the mouse, but not so static, more like, if you move your mouse up, it should kinda rotate first, and then you move the mouse further away, it should begin to follow again (If you know what I mean).

Is that something simple to do, or 3k lines? (Or maybe a jQuery plugin?)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T07:05:27+00:00Added an answer on June 6, 2026 at 7:05 am

    Hiya I got it something more closer by using an old post of mine : demo http://jsfiddle.net/Z3pGQ/3/

    I am still working, will flick you more smoother version or if you can improve before me:

    Old post: Rotating an element based on cursor position in a separate element

    Hope it helps, I am trying to make it smoother now, cheers

    Sample code

    $(document).ready(function() {
        $(document).mousemove(function(e) {
            $(".firefly").css({
                "top": (e.pageY * 2) + "px",
                "left": (e.pageX * 2 + 130) + "px"
            });
        })
    })
    var img = $(".firefly");
    if (img.length > 0) {
        var offset = img.offset();
    
        function mouse(evt) {
            var center_x = (offset.left) + (img.width() / 2);
            var center_y = (offset.top) + (img.height() / 2);
            var mouse_x = evt.pageX;
            var mouse_y = evt.pageY;
            var radians = Math.atan2(mouse_x - center_x, mouse_y - center_y);
            var degree = (radians * (180 / Math.PI) * -1) + 90;
            img.css('-moz-transform', 'rotate(' + degree + 'deg)');
            img.css('-webkit-transform', 'rotate(' + degree + 'deg)');
            img.css('-o-transform', 'rotate(' + degree + 'deg)');
            img.css('-ms-transform', 'rotate(' + degree + 'deg)');
        }
        $(document).mousemove(mouse);
    }​
    

    Image

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Something is eluding me ... it seems obvious, but I can't quite figure it
Something I'm trying to figure out now is to setup custom domain hosting so
Something I have always been interested in out of curiosity, is there a tool
Something in here is incompatible with PHP5, but I am totally lost as to
Something I have been wondering about properties for a while. When you are using
Something I wrote throws a lot of AttributeError exceptions when using time.strptime() inside a
I have a jquery bug and I've been looking for hours now, I can't
Something like the following will not give me a compile-time or runtime error and
Something in my PHP script is causing a fatal error, but I ca't seem
Something I have never thought too hard about but I am curiuos and want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.