Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Dan Ebbert’s ferris wheel expression Add Gravity

  • Dan Ebbert’s ferris wheel expression Add Gravity

    Posted by David Rodriguez on November 30, 2007 at 10:37 pm

    I am using Dan Ebbert’s ferris wheel expression to create a parade of logos on a wheel…

    **********************************************************
    n = 15; // number of ferris wheel “cars”
    r = 200; //radius of ferris wheel

    a = degrees_to_radians(360/n)*(index-1);
    x = 0;
    z = r*Math.cos(a);
    y = r*Math.sin(a);
    [x,y,z]

    Create a null (“Null 1” in this example), move it to the bottom of the layer stack, make it 3D, make the null the parent of the video layers, and apply this expression for x rotation to each of the video layers:

    -this_comp.layer(“Null 1”).rotationX
    **********************************************************

    I have manually keyframed the rotation of the Null so that as each “car” passes in front of the camera it stops and swings back up a bit then continues on its way, it is as if the ferris wheel “car” hits an invisible “ground” and reacts for a moment then the “ground” disappears and the “cars” pick up speed and continue on their way until the next “car” hits the next invisible “ground”, kind of like a gravity bouncing ball effect.
    Is there any way to have an expression that will do this for me?

    Many Thanks!

    Mike Clasby replied 18 years, 5 months ago 2 Members · 5 Replies
  • 5 Replies
  • Mike Clasby

    December 1, 2007 at 2:19 am

    Here is another Dan expression, hacked a bit to do what you want.

    If you put a marker on the layer you want to rock, as if stopping I presume, the layer will rock with a dampening motion. This rock/dampening is added onto Dan’s original x Rotation Expression. This also goes on X Rotation of each car.

    amp=70; //amplitude (pixels)
    freq=2; //frequency (cycles per second)
    decay=2.5; //decay time (seconds)

    // find previous marker

    n = 0; // assume haven’t reached a marker yet
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time){
    n–;
    }
    }

    if (n > 0) t = time – marker.key(n).time else t =0;
    a = amp*Math.sin(freq*t*Math.PI*2)/Math.exp(decay*t);
    -this_comp.layer(“Null 1”).rotationX + a

    Change amp, freq, and decay as needed.

    You can add markers on selected layers by hitting the * key on the numeric pad.

  • David Rodriguez

    December 3, 2007 at 2:34 am

    This expression only affects the layer it is applied to not the wheel as a whole, also I need to keep the “cars” oriented towards the camera so the rotation along the x axis is undesirable. I suppose an expression that was applied to each layer and was triggered by a marker COULD work..if it was applied to the position instead of the rotation, but I have no idea how to marry the existing expression for position with one that would do what I need it to.
    The expression you posted was pretty nifty though!
    Thanks for responding.

  • Mike Clasby

    December 3, 2007 at 3:49 am

    I guess I don’t really understand what you’re trying to do. I don’t understand why the X Rotation is undesirable, I followed the Dan Directions for setting up the Ferris Wheel and added a camera, I had to rotate that camera with the Orbit Tool, as the original setup when adding a camera was more like a TOP view, so I reoriented the camera. Maybe that’s where our misunderstanding lies, anyway…

    Do you want the wheel to stop, a dampened stop, and all the cars react to that? If that’s what you want, put a Marker on the Null layer where you keyframe a stop, and put this expression on the Nulls’ X Rotation, and the wheel, well all the cars that make up the wheel, will dampen to a stop when that marker (Null) is hit:

    amp=70; //amplitude (pixels)
    freq=1; //frequency (cycles per second)
    decay=2.5; //decay time (seconds)

    // find previous marker

    n = 0; // assume haven’t reached a marker yet
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time){
    n–;
    }
    }

    if (n > 0) t = time – marker.key(n).time else t =0;
    a = amp*Math.sin(freq*t*Math.PI*2)/Math.exp(decay*t);
    value + a

    They still wont rock, their X rotation in reaction to the wheel as a whole stopping, so put this rotation on the X Rotation of each Car on the wheel:

    amp=70; //amplitude (pixels)
    freq=2; //frequency (cycles per second)
    decay=2.5; //decay time (seconds)

    // find previous marker

    q = this_comp.layer(“Null 1”);
    n = 0; // assume haven’t reached a marker yet
    if (q.marker.numKeys > 0){
    n = q.marker.nearestKey(time).index;
    if (q.marker.key(n).time > time){
    n–;
    }
    }

    if (n > 0) t = time – q.marker.key(n).time else t =0;
    a = amp*Math.sin(freq*t*Math.PI*2)/Math.exp(decay*t);
    -this_comp.layer(“Null 1”).rotationX + a

    Now each car will see the marker on the Null and rock/dampen to that.

  • David Rodriguez

    December 3, 2007 at 4:47 am

    You rock? Yes you do.
    EXACTLY what I needed.

    Thank You

  • Mike Clasby

    December 3, 2007 at 7:20 am

    Cool.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy