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 877937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:41:29+00:00 2026-05-15T11:41:29+00:00

Essentially what I’m trying to do is nearly the same as this: http://www.senocular.com/flash/source/?id=0.16 However

  • 0

Essentially what I’m trying to do is nearly the same as this:
http://www.senocular.com/flash/source/?id=0.16

However I’d like to ease/tween the movieclip position and rotation to the mouse position.

The main issue I see is trying to get the current movieclip rotation and the target rotation, then tween it cockwise or counterclockwise from current to target. The way a movieclips rotation uses positive and negative numbers throws it off. If you just want to lock the mc rotation to the mouse rotation its fine, but once you try to tween it you run into difficulties.

So the end effect would be like if you were to draw imaginary clockwise circles around the object, it should just keep rotating clockwise towards the mouse. Then if you started going counter clockwise it should just keep easing counter clockwise to the mouse.

Thanks for any help.

  • 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-05-15T11:41:29+00:00Added an answer on May 15, 2026 at 11:41 am

    So there are two parts. One, you want to find the shortest angle between two angles. Two, you need to ease between the angles and position.

    Finding shortest angle.

    angleDelta will be the shortest rotation angle between your two angles.

    var angleDiff:Number = angleTo - currentAngle;
    var angleDelta:Number = Math.atan2(Math.sin(angleDiff), Math.cos(angleDiff));
    angleDelta *= (180/Math.PI); // Change angle from Radians to Degrees.
    

    Ease between values

    I usually use a simple equation in some kind of loop (usually enterFrame) to ease between simple values.

    addEventListener(Event.ENTER_FRAME, enterFrameHandler);
    private function enterFrameHandler(e:Event):void 
    {
        rotation += (targetRotation - currentRotation) * 0.2;
        x += (targetX - currentX) * 0.4;
        y += (targetY - currentY) * 0.4;
    }
    

    EDIT*

    This should work for you.

    const TO_DEGREES:Number = 180 / Math.PI;
    const TO_RADIANS:Number = Math.PI / 180;
    
    addEventListener(Event.ENTER_FRAME, enterFrameHandler);
    
    function enterFrameHandler(e:Event):void
    {
        var angleTo:Number = Math.atan2(stage.mouseY - y, stage.mouseX - x) * TO_DEGREES;
        if (angleTo > rotation+180) angleTo -= 360;
        if (angleTo < rotation-180) angleTo += 360;
    
        rotation += (angleTo - rotation) * 0.2;
        x += (stage.mouseX - x) * 0.2;
        y += (stage.mouseY - y) * 0.2;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Essentially the title of this question explains the essense of what I am trying
Essentially what I'm trying to do at this point is build a program to
Essentially I need to do something like this.... this is just an example... but
Essentially, I want to be able to do something like this: struct Foo {
Essentially I'd like to know just how compatible are the iPhone and the iPod
Essentially I would like to have a messages.properties files external to the jar files
Essentially, what I'm trying to do is to check the last access time of
Essentially, when a button is pressed the randomMove() method is called, this is mean't
Essentially, I would like to create a database structure that allows for classifying an
Essentially, I have three coordinates in play. Cleveland, TN -- (35.255097,-84.86844) -- This is

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.