The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 4 of 4

Thread: Elliptical trajectory / motion in as 2.0?

  1. #1

    Elliptical trajectory / motion in as 2.0?

    Hey guys, first of all, sorry if this was asked before, i did use the search option first (glanced a bit) and didn't find something related quick so decided to ask:

    Does anyone know the correct way for creating an elliptical motion in flash 8? I googled for ellipse equations and stumbled upon these:

    http://en.wikipedia.org/wiki/Ellipse

    Lower on the page there's also some code (javascript) which generates points that can then be connected to form an ellipse. tried to replicate that in flash, but haven't succeeded. Also, i was wondering if there was another way i could generate an ellipse, which looks more like this http://www.rsc.org/ej/JM/2000/b002092n/b002092n-f4.gif, in the sense that it's "tilted".

    I am trying to replicate a sort of solar system, but with elliptical trajectories, and would have liked to have the sun in an upper corner and the planets rotating around it in a sort of "tilted" ellipse.

    I also tried to modify the Circular Movement tut also http://www.kirupa.com/developer/mx/circular.htm.

    Sorry if the question is dumb or already answered in a previous post. Thanks in advance!

  2. #2
    1,532
    posts
    I make half sense
    parabola is another term

    carousel is an example that would work, you could stick it in a MC then tilt the mc (check my sig or gotoandlearn.com for a carousel)

    also you could just draw a circle squish it to an elipse, turn it, then make MC's follow the path.
    Click my sig.

  3. #3
    i wrote this recently it might be helpful if you want to make it dynamic. r1 is the width of the elipse, r2 is the height, tilt is the rotation, and speed is the number of degrees per frame that it moves at...

    Code:
    onClipEvent(enterFrame) {
      offset += speed;
      offset %= 360;
      _x = x_center + Math.cos(offset * Math.PI / 180) * r1 * Math.cos(tilt * Math.PI / 180) + Math.sin(offset * Math.PI / 180) * r2 * Math.sin(tilt * Math.PI / 180);
      _y = y_center - Math.cos(offset * Math.PI / 180) * r1 * Math.sin(tilt * Math.PI / 180) + Math.sin(offset * Math.PI / 180) * r2 * Math.cos(tilt * Math.PI / 180);
    }
    hope it's useful.

  4. #4
    thanks, it worked!

    i was using a wrong formula, this worked perfectly.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012