Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Delaying Keyframes via Slider & Layer Index

  • Delaying Keyframes via Slider & Layer Index

    Posted by Christopher Bly on November 3, 2017 at 8:40 pm

    So I’m currently trying to write an expression that causes keyframes to be delayed based on both a slider and their layer index so I can quickly retime a large animation sequence. To explain the code itself a bit more, I’m using a slider called “Time Progression” in place of the time function so I can control the speed of time as well as start/stop/reverse it and all that using keyframes, this is in the expression as the variable pTime. I’ve got another slider called “Animation Delay” that represents the number of frames that each progressive layer is delayed by, in my current comp it’s set to something crazy like 819 for testing purposes. The layer is also having four subtracted from its index so the expression will ignore some extra layers at the top of the comp.

    The problem I’m running in to is that the animation always starts as soon as the pTime slider starts, as if the delay is always 0. This is regardless of where I place the layer in the layer order. If anyone has any ideas on why this may be happening or how I may be able to fix it, please do. I am open to suggestions.

    var pTime = framesToTime(thisComp.layer("CONTROL").effect("Time Progression")("Slider"));
    var aDelay = thisComp.layer("CONTROL").effect("Animation Delay")("Slider");
    var nIndex = index-4;
    var startTime = aDelay*nIndex;
    var key1 = thisProperty.key(1);
    var key2 = thisProperty.key(2);
    var keyDuration = key2.time-key1.time;

    if (pTime<=startTime){
    key1;
    }else if(pTime>startTime && pTime<(startTime+keyDuration)){
    valueAtTime(key1.time+(pTime-startTime));
    }else{
    key2;
    }

    Christopher Bly replied 8 years, 6 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

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