Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions object on a string damping

  • object on a string damping

    Posted by Göran Thorén on June 13, 2008 at 1:22 pm

    Hi all!
    I looking to create an anomation that looks like an object is droped from top and damps like it was attached to a string.
    I tried Dans “jack in a box” expression but it didn´t really work the way i would like.
    Any suggestions?

    Thank´s

    Husse

    Jerry Adams replied 14 years, 2 months ago 6 Members · 8 Replies
  • 8 Replies
  • Dan Ebberts

    June 13, 2008 at 4:59 pm

    Try this:

    g = 3500; // gravity (pixels/second/second)
    floor = 400;
    e = .35; //elasticity

    b = floor – position[1];
    h = b;
    T = Math.sqrt(2*h/g);

    if (time < T){ y = - g*time*time/2 + b; }else{ Vy = g*T; while (true){ Vy *= e; t = T; T += 2*Vy/g; if (time < T){ t = time - t; y = Vy*t - g*t*t/2; break; }else if (T - t < thisComp.frameDuration){ y = 0; break; } } // end while } [value[0], floor - y] Dan

  • Göran Thorén

    June 15, 2008 at 9:00 pm

    What can I say.. Dan you´re the man!
    Thank´s a million!

    Husse

  • Adam Lukas

    February 22, 2009 at 2:48 am

    What exactly is this expression applied to? sorry this is such a noob question…

  • Adam Lukas

    February 22, 2009 at 3:47 am

    never mind, i figured out what i was doing wrong 🙂

  • Dan Ebberts

    February 22, 2009 at 4:12 am

    The Position property.

    Dan

  • Brad Hilton

    September 2, 2010 at 7:03 pm

    will this work in cs5?

    cause im getting an error message.

    After Effects warning: Timeout while waiting for the engine
    Expression disabled.

    Error occurred at line 16.
    Comp: ‘Cloud2’
    Layer: 1 (‘Vector Smart Object’)
    Property: ‘Position’

    g = 3500; // gravity (pixels/second/second)
    floor = 400;
    e = .35; //elasticity

    b = floor - position[1];
    h = b;
    T = Math.sqrt(2*h/g);

    if (time &lt; T){
    y = - g*time*time/2 + b;
    }else{
    Vy = g*T;
    while (true){
    Vy *= e;
    t = T;
    T += 2*Vy/g;
    if (time &lt; T){
    t = time - t;
    y = Vy*t - g*t*t/2;
    break;
    }else if (T - t &lt; thisComp.frameDuration){
    y = 0;
    break;
    }
    } // end while
    }
    [value[0], floor - y]

  • Dan Ebberts

    September 2, 2010 at 7:52 pm

    You’ll get that error if you start your bouncing layer below the “floor” (y = 400 in this case).

    Dan

  • Jerry Adams

    March 15, 2012 at 11:53 pm

    well..this is too hard for me… can enyone do a tut for this effect…pls?

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