Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions just how to use “speed”

  • just how to use “speed”

    Posted by Andy Engelkemier on June 21, 2011 at 1:16 pm

    I must be going about this all wrong because I’m getting no results, the help file is no help, and there are too many cases where people specify their own speed that google is no help either.

    I’m trying to control bend based on speed. Sounds simple, but what the heck is the syntax suppose to be?

    I created some keys where the object moves in the positive X direction. It really only moves in x.
    Next I applied some bend to make sure that looks ok….ok, now add expression.

    I tried just speed. – nothing
    I tried speed *500000 just to make sure it’s not some tiny number – nothing
    ok maybe speed.transform.position[0]? nope
    transform.position[0].speed? nope

    Then I thought, Oh, I’ll just get my own speed. But then I couldn’t figure out how to get position at a different time, so that’s no help either. I was thinking of just using position.x – position.x at previous frame. That would give me a useable number to do this bend thing to, but I couldn’t find a way to get position at time.

    Any help here is appreciated. Even if it’s being snippy and telling me where to actually find the information. 😉

    Dan Ebberts replied 14 years, 11 months ago 2 Members · 6 Replies
  • 6 Replies
  • Andy Engelkemier

    June 21, 2011 at 1:47 pm

    well I got it to work, but still would like to know how to get it to work using speed.

    I’m using 24fps so wanted to get the position 1/2 keyframe back to calculate from.

    I thought you could do: position[0].valueAtTime…
    but that gave me an error, so instead I put a variable to it, then called the variable’s first value instead.

    Also for some stupid reason I couldn’t get the syntax right for just calling thisLayer. I thought it was suppose to be: thisComp.layer(thisLayer)…
    After failing at that I said, “F it” and just put the layer name instead just so the expression at least works right now.

    Here’s what I used. I’d still love some help though.

    posOld = thisComp.layer("timeline box").position.valueAtTime(time - (1/48));
    (posOld[0] - transform.position[0])*-5;

  • Dan Ebberts

    June 21, 2011 at 2:31 pm

    I think this is all you need:

    transform.position.speed

    thisLayer is assumed, so you don’t need to specify it.

    Dan

  • Andy Engelkemier

    June 21, 2011 at 3:36 pm

    hmmm, so what am I doing wrong then. Given that I’m applying it to a single digit I need to break it down to only one number of the array, so I did this, but it doesn’t work.
    expression error. Can you spot anything wrong with it?

    also can you do things like:
    transform.position[0].speed

    That was the first thing I tried as a single line, but AE didn’t like it.

    p = transform.position.speed;
    p[0];

  • Dan Ebberts

    June 21, 2011 at 4:00 pm

    .speed is a one-dimensional attribute. If your layer is only moving in the x-direction, transform.position.speed should give you what you want. If it’s also moving in the y direction and you just want x, you would use the x component of .velocity, like this:

    transform.position.velocity[0]

    Dan

  • Andy Engelkemier

    June 21, 2011 at 6:06 pm

    so I guess I was unnecessarily trying to make it much harder than it really was. For some reason I was thinking it would give speed for multiple directions and I was thinking velocity was more complex than just speed in both directions. I suppose that’s all you need to define the vector of a 2D movement.

    It’s working now. Although, I’m not sure why you can’t specify the first value in an array of 1. I know that’s dumb, but couldn’t the computer still figure out that you want The value?

    I wish I could find some good online resources so I didn’t have to keep bugging you. I’m not a fan of books because it takes too long to search through to find something specific. Although, I suppose since I’m not specifically calling you out, you Are helping voluntarily. And for that, I thank you.

  • Dan Ebberts

    June 21, 2011 at 6:17 pm

    >I’m not sure why you can’t specify the first value in an array of 1.

    You can, if it’s stored as an array (which speed isn’t). In general, one-dimensional properties and attributes are stored as scalars and multi-dimensional properties and attributes are stored as vectors (arrays).

    Dan

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