Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions valueAtTime property gives “undefined” error

  • valueAtTime property gives “undefined” error

    Posted by William Meese on December 8, 2009 at 12:28 am

    The goal is to vary an effect’s property using the layer’s horizontal velocity, caused by animating its anchor point.

    My thinking is that the expression
    transform.anchorPoint[0]-transform.anchorPoint[0].valueAtTime(time-(1/24))
    Should give the horizontal velocity for the frame.
    But while just
    transform.anchorPoint[0]
    or just
    valueAtTime(time-(1/24))
    don’t return errors,
    transform.anchorPoint[0].valueAtTime(time-(1/24))
    returns the error
    “Function transform.anchorPoint[0].valueAtTime is undefined”

    What am I doing wrong?

    transform.anchorPoint[0]-transform.anchorPoint[0].valueAtTime(time-(1/24))

    William Meese replied 16 years, 5 months ago 3 Members · 4 Replies
  • 4 Replies
  • Xinlai Ni

    December 8, 2009 at 12:30 am

    try valueAtTime(…)[0] instead.
    BTW, anchorPoint.speed is more general (you don’t have to write the frame rate).

    Xinlai Ni
    Software Engineer, Google Inc.

  • William Meese

    December 8, 2009 at 3:15 am

    I thought “speed” would give the actual distance moved, whatever the direction, while I need just the horizontal component.

    Your “try valueAtTime(…)[0] instead” tip confused me for a while, but it clicked: valueAtTime is a property, so it needs to come before specifying the dimension.

    “transform.anchorPoint[0]-transform.anchorPoint.valueAtTime(time(1-24))[0]”

    is working. Thanks!

  • Dan Ebberts

    December 8, 2009 at 3:47 am

    How about just this?

    transform.anchorPoint.velocity[0]

    Dan

  • William Meese

    December 8, 2009 at 7:18 am

    When I RTFM I find that “speed” always returns a 1D, positive value, but”velocity” returns a result w/ the same dimension as the property.
    So thanks, Dan; a more elegant solution.

    When I plug it in, the results are similar but not identical–perhaps a matter of which chunk of the timeline is being sampled; my original math samples the frame before, “velocity” is probably the value at the instant of the frame start.

    At least now the expression functions. Onward–and thanks again, guys.

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