Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions somebody analyses this expression into simple math language

  • somebody analyses this expression into simple math language

    Posted by Mostafa Talebi on September 5, 2011 at 7:47 pm

    This is a bounce-motion expression

    Can really anyone explain this expression? It’s not really hard for me to understand the expression but I want to know its mathematical relations and analysis.
    THANKS

    var bouncesPerSecond = 1.5;
    var bounceStrength = 200;
    var decayRate = .5;
    var floor = thisComp.layer( " floor " ).transform.
    position[1];
    var bounceOffset = Math.abs(Math.cos(bouncesPerSecond
    * time * 2 * Math.PI));
    var y = bounceStrength * bounceOffset/Math.exp(decay
    Rate * time);
    floor = floor = (height/2);
    [position[0], floor] = [0,y]

    Dan Ebberts replied 14 years, 8 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    September 5, 2011 at 8:13 pm

    That expression has some errors, but basically, it’s using an exponentially damped, full-wave rectified cosine wave to define a bounce path. This expression does the same thing (I think) and might be slightly easier to understand. Just position your layer above the layer named “floor” and it will drop from there and bounce:


    freq = 1.5;
    decay = .5;
    floor = thisComp.layer("floor").transform. position[1];
    d = value[1] - floor;
    y = d*Math.abs(Math.cos(freq*time*2* Math.PI))/Math.exp(decay*time);
    [value[0],floor] + [0,y]

    This kind of expression works pretty good for an oscillating motion (like a spring or pendulum) but isn’t very realistic as a bounce, because when something bounces, the frequency increases as the bounce height gets smaller. That makes it a much trickier expression though.

    Dan

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