Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Layer Control and Focus Distance

  • Layer Control and Focus Distance

    Posted by Brian Charles on April 2, 2011 at 1:37 am

    I’ve modified Dan Ebberts terrific Focus Distance expression so it can be keyframed, however it would be much easier if the Layer Control could be keyframed.

    Is it possible to do so, either through a custom preset or another method?

    Is this method the best way?

    Here’s what I’m doing:

    currentTarget = thisComp.layer("Focus Control").effect("Layer Target")("Slider");
    currentTarget = Math.round(currentTarget);
    target = thisComp.layer(currentTarget);
    v1 = target.toWorld(target.anchorPoint) - toWorld([0,0,0]);
    v2 = toWorldVec([0,0,1]);
    dot(v1,v2)

    Brian Charles replied 15 years, 1 month ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    April 2, 2011 at 2:29 am

    There’s no way to keyframe a layer control. I guess the other possibility would be to keyframe the layer names into a hidden text layer. It’s a little more trouble, but at least it shouldn’t get messed up (like a slider would) if you add new layers to the comp.

    Dan

  • Brian Charles

    April 2, 2011 at 2:33 am

    Dan, thanks for the reply. I’ve made a feature request to Adobe.

    The slider method is a bit clumsy because its easy to mess up, I guess I’ll need to pay more attention 😉

  • Dan Ebberts

    April 2, 2011 at 3:00 am

    You know, you could do it with (camera) layer marker comments, and that might even be more flexible that keyframes. It would look like this:


    n = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time) n--;
    }
    if (n > 0){
    try{
    target = thisComp.layer(marker.key(n).comment);
    v1 = target.toWorld(target.anchorPoint) - toWorld([0,0,0]);
    v2 = toWorldVec([0,0,1]);
    dot(v1,v2)
    }catch(err){
    value
    }
    }else{
    value
    }

    The target would switch at each marker.

    Dan

  • Brian Charles

    April 2, 2011 at 6:15 am

    Dan, you are the bomb. Many Thanks.

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