Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Is there an AE expression that can provide the same function as a driven key in Maya?

  • Is there an AE expression that can provide the same function as a driven key in Maya?

    Posted by Francis De la torre on December 11, 2008 at 10:46 pm

    Hi folks,
    working in both Maya and After Effects, I have notice where each program has strength and weaknesses over each other. One function I love in Maya, is the ability to utilize “Driven Keys,” to control multiple attributes on multiple objects while only manipulating one set of keyframes. I am curious is there is a script that can allow the same process in after effects?

    Thanks

    here is a quick description of what a “driven Key” is, for those that are unfimilar:

    Maya has a special type of key called a driven key that links one attribute value to another. When you create a driven key, you specify a driver attribute value and a driven attribute value. The value of the driven attribute is locked to a corresponding value of the driver attribute.

    By linking several values of the driven and driver attributes, you create a predictable relationship between the attributes. A change in the driving attribute alters the value of the driven attribute. For instance, you can set driven keys to make a door open when a person walks in front of the door.

    An attribute can be driven by multiple attributes. For instance, you can make a muscle bulge when an elbow rotates, and bulge even more when the wrist rotates. The muscle bulge is the driven attribute, and the elbow and wrist rotation are the driving attributes.

    In standard animation keys, an attribute has values keyed to frames in the Time Slider. For a driven key, an attribute has values keyed to the value of a driving attribute.

    The Time Slider is not involved in a driven key relationship and displays no red markers for the keys. Playing or scrubbing the animation alters the value of a driven attribute only if you animate the value of the driving attribute over time.

    more info:

    ” target=”_blank”>https://caad.arch.ethz.ch/info/maya/manual/UserGuide/Animation/KeyframeMoPath/03_understanding_key.doc5.html

    Dan Ebberts replied 3 years, 10 months ago 3 Members · 10 Replies
  • 10 Replies
  • Dan Ebberts

    December 12, 2008 at 4:16 pm

    It sounds pretty much like one of the things you can do with expressions: link two properties together. Maybe I’m not getting it.

    BTW – I couldn’t get your link to work.

    Dan

  • Francis De la torre

    December 18, 2008 at 7:22 pm

    Hey Dan,
    sorry for my lack of articulation. The function is very difficult to explain verbally. If you can imagine using a slider expression controller, and linking any attribute on several other objects to the slider. Now when slider vaule= 1, all objects have a specified set of attribute values (position, rotation, transparency, effect attribute value, etc); when slider value= 2, all objects have a new specified set of attribute values; when slider value= 3, all objects have a new specified set of attribute values, etc.

    Now when I animated the slider value, the other object attributes, animate between their specified set of attribute values.

    That in a nutshell is what a driven key does in maya.

    Thanks for the help Dan.

  • Dan Ebberts

    December 18, 2008 at 9:01 pm

    I think the best you could do would be to apply a slider to a layer (named “control” in this example). Then, for each property you want to control, you’d need to apply an expression like this to remap the slider range to the parameter range. This rotation example is set to go from -10 to +50 degrees as the slider goes from 0 to 100:

    slider = thisComp.layer(“control”).effect(“Slider Control”)(“Slider”);
    sliderMin = 0;
    sliderMax = 100;
    myMin = -10;
    myMax = 50;

    linear(slider,sliderMin,sliderMax,myMin,myMax)

    Dan

  • Dan Ebberts

    December 18, 2008 at 9:12 pm

    I thought of another way, if you need access to the values and you don’t want to edit the expressions all the time. In fact, this way you could use the same expression for all your parameters. The idea is that you would set a keyframe at time zero for the parameter value you wanted to correspond to 0 on the slider. Then you’d move forward one frame and set a value corresponding to the slider’s 100. Then apply this expression to the parameter:

    slider = thisComp.layer(“control”).effect(“Slider Control”)(“Slider”);
    sliderMin = 0;
    sliderMax = 100;
    myMin = valueAtTime(0);
    myMax = valueAtTime(thisComp.frameDuration);

    linear(slider,sliderMin,sliderMax,myMin,myMax)

    Dan

  • Francis De la torre

    December 18, 2008 at 10:32 pm

    Thanks Dan. I really appreciate you taking some time to chew on this. I will give this method an attempt, and see where the results land.

  • Francis De la torre

    December 18, 2008 at 10:38 pm

    Just saw your second post. This is exactly how it works in maya! The attributes controlled by the driven key are assigned a timeline keyframe starting at frame 0 and moving forward in 1 frame increments (these timeline keyframes carry no actually animation, but are simply references for the driven key). Each frame increment relates exactly to the value placed in the driven key. So value 1 on the driven key looks at frame 1 for the keyed attributes. The expression solution you provided sounds exactly like what I am looking for. I will test over the next couple days and report my results.

    Thanks Again!

    The Best

    F De La Torre
    http://www.francisdelatorre.com

  • Peakash Patel

    November 3, 2022 at 5:29 pm

    Hi Dan,

    Sounds like a great solution. I’m a maya user and use set driven keys a lot.

    I’m trying to use your solution at the moment and am having trouble figuring out how to hook it up etc. Any help would be appreciated.

     

    Kind regards.

     

    Peakash

  • Dan Ebberts

    November 3, 2022 at 5:49 pm

    Having never used Maya, I’m not sure how much help I can be…

  • Peakash Patel

    November 3, 2022 at 6:14 pm

    Hi Dan,

    I was wondering how to connect up in After Effects?

    I seem to be getting Syntax errors etc.

    Do you have an example file?

    Kind regards.

    Peakash

  • Dan Ebberts

    November 3, 2022 at 6:44 pm

    Add a null to your comp, name it “control” and add a Slider Control to it.

    For whatever property you’re animating, set a keyframe at time = 0 for the initial value, go forward one frame and set a keyframe for the final value. Then add this expression (don’t use the code from 2008–it got trashed when they updated the site)_:

    slider = thisComp.layer("control").effect("Slider Control")("Slider");
    sliderMin = 0;
    sliderMax = 100;
    myMin = valueAtTime(0);
    myMax = valueAtTime(thisComp.frameDuration);
    linear(slider,sliderMin,sliderMax,myMin,myMax)

    The slider should then control the animation.

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