Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Stop loopOut smoothly?

  • Stop loopOut smoothly?

    Posted by Klemens Hertha on May 4, 2012 at 11:42 am

    Hi guys!

    Once again I need a little help please: I’m trying to stop the loopOut- and wiggle-expressions at a specified time, but smoothly! I don’t want the values to suddenly jump back at the default values from one frame to another when the specified time has been reached!

    For the wiggle expression I finally accomplished it with the first code below and animating the amp-slider to zero, when I want the animation to stop. But here too I would be happy about an expression which works without keyframing a slider!
    But for the loopOut-thing I’m stuck! The code I’m using right now is the second one below. It works, but the thing I’m using it on is the puppet-tool-position for character-animation and – needless to say – it doesn’t look good, when all the puppet-pins jump back over big distances from one frame to another! What expression can I use, to smoothly move all the puppet-pins to their default values at a specified time, no matter which position-values they have at this time?

    Many thanks in advance,
    Klemens

    freq = thisComp.layer("SLIDER CONTROL").effect("Slider Control FREQ")("Slider")
    amp = thisComp.layer("SLIDER CONTROL").effect("Slider Control AMP")("Slider")
    wiggle(freq, amp)

    t = thisComp.layer("SLIDER CONTROL").effect("Slider Control TIME")("Slider")
    if (time < t)
    loopOut()
    else
    value

    Klemens Hertha replied 14 years ago 2 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    May 4, 2012 at 3:45 pm

    Something like this maybe:

    t = thisComp.layer(“SLIDER CONTROL”).effect(“Slider Control TIME”)(“Slider”);
    fadeTime = 1;
    linear(time,t,t+fadeTime,loopOut(),value)

    Dan

  • Klemens Hertha

    May 4, 2012 at 4:09 pm

    Works like a charm! Thank you so much!

    Just for my understanding, please tell me if I got this right: The linear-expression uses only value1 (in this case loopOut) until tMin is reached, and after tMin is reached it interpolates over the specified fadeTime to value2. Correct?

  • Dan Ebberts

    May 4, 2012 at 4:14 pm

    That’s exactly correct.

    Dan

  • Klemens Hertha

    May 4, 2012 at 4:57 pm

    Great, thanks again! 🙂

    One last short (different) question: Is there a way to apply an expression to many effect controls at the same time rather than pasting it to every single one separately? Like if I have 100 puppet-pins and I want the same expression on every pin – is there any trick I dont know??

  • Dan Ebberts

    May 4, 2012 at 5:35 pm

    For the same property on different layers, you can select the property, the Edit > Copy Expression Only, select all the other layers, and paste.

    For puppet pins, you could apply your expression to Puppet Pin 1, and then run a script like this to copy the expression to all the other pins:


    {
    var myProps = app.project.activeItem.selectedProperties;
    var myProp = null;
    for (var i = 0; i < myProps.length; i++){
    if (myProps[i].name.indexOf('Puppet Pin 1') == 0){
    myProp = myProps[i];
    break;
    }
    }
    if (myProp != null){
    var myExpr = myProp.property("Position").expression;
    if (myExpr != ""){
    var myDeform = myProp.propertyGroup(1);
    var numPins = myDeform.numProperties;
    for (var i = 2; i <= numPins; i++){
    myDeform.property("Puppet Pin " + i).property("Position").expression = myExpr;
    }
    }else{
    alert("Puppet Pin 1 doesn't have expression.");
    }
    }else{
    alert("Puppet Pin 1 not selected.");
    }
    }

    Dan

  • Klemens Hertha

    May 4, 2012 at 6:13 pm

    You are awesome! Thank you!

    I’m not in the office anymore, but I’ll definitely try this on Monday!

    Btw: I’ve just discovered your website today – I’ll do some further reading there for sure!

    Best regards,
    Klemens

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