Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Converting old motion math preset into expression

  • Converting old motion math preset into expression

    Posted by J2m on October 10, 2005 at 5:24 pm

    Hi all,

    I need to use the old “spring” motion math preset in AE 6.5. Unfortunately, I’m extremely lame in understanding Java script logic. The .MM format cannot be imported in AE any more, and the text within it can’t be imported as an expression AS IT IS.

    Is there any way to easily convert this text so that it can be imported as an expression ?

    Sorry if the answer is obvious to you guys, but I just can’t figure it out by myself…

    Thanks a lot to anyone who can help !

    Just in case, here is the text content of the old .MM file :

    // One spring – version 1.2

    // This script attaches a spring between the 2 layers shown in the popups.
    // Layer 1 keeps its original motion, while layer 2 is attached by a spring to it.

    // LAYER PROPERTY CHANNEL
    // —— ———- ——–
    // 1: Layer that moves doesn’t matter doesn’t matter
    // 2: Layer attached to #1 by a spring doesn’t matter doesn’t matter

    if (time() == start_time) {
    rest_length = 10; // rest length of spring in pixels
    damp = 0.95; // Damping (0 = infinite friction, 1 = none)

    p1 = value(pop_layer(1), position);
    p2 = value(pop_layer(2), position);

    last_p1 = tmap(time() – step_time, value(pop_layer(1), position));
    last_p2 = tmap(time() – step_time, value(pop_layer(2), position));

    v1 = (p1 – last_p1);
    v2 = (p2 – last_p2);
    } else {
    p1 = value(pop_layer(1), position);

    delta = p2 – p1;
    n_delta = normalize(delta);

    a = 2 * n_delta * (length(delta) – rest_length) * step_time;

    v2 = (v2 – a) * damp;
    v1 = (v1 + a) * damp;

    p1 = p1 + v1;
    p2 = p2 + v2;
    }
    value(pop_layer(2), position) = p2;

    J2m replied 20 years, 11 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 10, 2005 at 5:37 pm

    See the 10/7 thread “expression with springs”.

    Dan

  • J2m

    October 10, 2005 at 6:38 pm

    Oooops… I usually check the forum before posting, but this was such a specific problem that I wouldn’t have guessed someone else posted the same thing, and two days ago, no less !

    Thanks a lot for you reply. I must confess I didn’t expect to get one so soon. And your expression seems to do the trick, too.

    But it doesn’t change the fact that something has been lost with the removal of Motion Math. Expressions don’t replace it entirely. I don’t see why the Adobe team didn’t leave it there, especially since we still have the simple text effect in 6.5…!

    Anyway, thanks again.

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