Home > Math > Curve-Constrained Scrolling in Actionscript

Curve-Constrained Scrolling in Actionscript

February 10, 2009

I’ve received a few inquiries in recent weeks regarding parametric curves used as paths for a nonlinear scrolling UI element.  Essentially, a sprite is constrained to be dragged along a curve representing an outline of some part of the UI.  I’ve had to do this for more than one project, so some time ago I authored a TechNote on the process.

The TechNote starts with a simplistic timeline-based approach and then discusses some different approaches for handling the problem entirely in script.  This allows the method to be expanded to UI elements that are dynamically created.

Scrolling constrained to the outline of a UI element

Scrolling constrained to the outline of a UI element

Recently, some of the projection computations were used in the Degrafa quadratic Bezier join method.

  1. February 10, 2009 at 8:33 am

    You just reminded me of a time I did this back in Flash 4 or 5. Tweened a slider handle along a curved path and used gotoAndStop controlled by the mouse position. 🙂

    • February 10, 2009 at 9:19 am

      Ah … those thrilling days of yesteryear. At my age, I’m surprised I can even remember what I did in Flash 4 or 5 🙂

      regards,

      – jim

  2. A.
    February 10, 2009 at 9:32 am

    Hi,
    A working sample would be nice to look at..
    Thanks!

    • February 10, 2009 at 10:16 am

      There is a link in the TechNote to download the files, although it’s a pretty old example, so it’s Flash/AS2.

      regards,

      – jim

  3. JT
    February 10, 2009 at 3:14 pm

    This is cool – I have a comp-sci project coming up that I think I can use this on. I’m going to try and write it in Flex.

  1. No trackbacks yet.
Comments are closed.
%d bloggers like this: