Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Eric Sanderson on September 19, 2009 at 3:29 pm

    ive run into this here and there and just decided to ask about it instead of finding a work around like i usually do. Often when i need a row of objects or a “list” ill add an expression slider to my top layer, then just do a pos index-1+expression slider on the y for example and adjust the slider to spread duplicates of the layer out evenly vertically. So say i have that but now i want to animate the the top layer on the x and have the rest follow with valueAtTime…so now i add an xPos variable looking at index-1 and valueAtTime function added on the end of that. So i end up with this…

    x=thisComp.layer(“Menu Item 1”).transform.position[0].valueAtTime(time-thisComp.layer(“Menu Item 1”).effect(“xDelay”)(“Slider”));
    y= thisComp.layer(index-1).transform.position[1]+thisComp.layer(“Menu Item 1”).effect(“Button ySpacing”)(“Slider”);
    [x,y]

    but i get an error showing the top line of code and saying “valueAtTime” is “undefinable”…can you not add valueAtTime to a single value of an array or something? And if not what can i do to get what i want?

    Filip Vandueren replied 16 years, 7 months ago 2 Members · 3 Replies
  • 3 Replies
  • Filip Vandueren

    September 19, 2009 at 5:05 pm

    Get the valueAtTime of a property, then get the [0] like this:

    …position.valueAtTime(t)[0];

    this makes sense because position (a property) has a valueAtTime, while position[0] is actually shorthand for position.value[0] which is just a number.

  • Eric Sanderson

    September 20, 2009 at 3:13 pm

    ah that makes sense, so its really like its the “AtTime” part of the code thats the real function, value is already there by default

  • Filip Vandueren

    September 20, 2009 at 7:16 pm

    Not really,

    I was just saying that when you use l.transform.position you actually get a reference to the _property_ position itself, not it’s value, although After effects is usually clever enough to know you need the value, eventhough you omit it.

    “position” has several properties itself like .numKeys, or .name

    valueAtTime(t) is the full name of the method to get values at diff. times, so you can’t omit “value” in this context

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