Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Where do I add valueAtTime in this code?

  • Where do I add valueAtTime in this code?

    Posted by Steven Kutny on June 4, 2009 at 6:28 pm

    Hi,

    I’m curious if anybody out there could help me figure out how to make my expression do what I want?

    Here goes:

    x=thisComp.layer(“Controller”).effect(“x”)(“Slider”);
    y=thisComp.layer(“Controller”).effect(“y”)(“Slider”);
    z=thisComp.layer(“Controller”).effect(“z”)(“Slider”);
    value+[x,y,(index*(z))]

    The expression above is great! It does everything I want it to except for one little thing. I’d like to add the valueAtTime function to it so I can delay the position of each corresponding layer. It should be straight forward, but no matter where I add it, I always get an error.

    The expression below almost gets me everything I want except for one little thing. I can’t control individual layers positions once the expression is added. With the above expression, I can still offset each layer with my slider and also move any layer manually.

    x=thisComp.layer(“Controller”).effect(“x”)(“Slider”);
    y=thisComp.layer(“Controller”).effect(“y”)(“Slider”);
    z=thisComp.layer(“Controller”).effect(“z”)(“Slider”);
    thisComp.layer(index+1).position.valueAtTime(time – .5)+[x,y,z];

    So, there you have it. Nothing crazy, I hope it’s just a syntax thing. Any help is greatly appreciated.

    Thanks,

    Steve

    Steven Kutny
    Digital Artist
    http://www.stevenkutny.com

    Steven Kutny replied 16 years, 11 months ago 2 Members · 3 Replies
  • 3 Replies
  • Filip Vandueren

    June 5, 2009 at 3:52 pm

    I think you might need the valueAtTime in the sliders too:

    x=thisComp.layer(“Controller”).effect(“x”)(“Slider”).valueAtTime(time – .5);
    y=thisComp.layer(“Controller”).effect(“y”)(“Slider”).valueAtTime(time – .5);
    z=thisComp.layer(“Controller”).effect(“z”)(“Slider”).valueAtTime(time – .5);

    thisComp.layer(index+1).position.valueAtTime(time – .5)+[x,y,z];

    But this depends on how many parameters you’re keyframing.

  • Steven Kutny

    June 6, 2009 at 6:27 pm

    Hey Filip, thanks for your response. In that example, you don’t actually need to include the valueAtTime in each slider, it works the same by having it in the last line of code.
    But I’m actually trying to figure out where the “valueAtTime” fit’s into this expression.

    x=thisComp.layer(“Controller”).effect(“x”)(“Slider”);
    y=thisComp.layer(“Controller”).effect(“y”)(“Slider”);
    z=thisComp.layer(“Controller”).effect(“z”)(“Slider”);
    value+[x,y,(index*(z))]

    It’s almost the same thing except the “value+” gives me one more piece of added control for each layer. I just can’t seem to place the “valueAtTime” code in it without getting a syntax error. Any thoughts?

    Thanks,

    Steve

  • Steven Kutny

    June 10, 2009 at 4:58 pm

    Okay, I finally figured out what my problem was! It needs to be written like this:

    x=thisComp.layer(“Controls”).effect(“x”)(“Slider”)-thisComp.width/2;
    y=thisComp.layer(“Controls”).effect(“y”)(“Slider”)-thisComp.height/2;
    z=thisComp.layer(“Controls”).effect(“z”)(“Slider”);
    value+thisComp.layer(index +1).position.valueAtTime(time – .5)+[x,y,z];

    So now, with the added thisComp.width/2 and this Comp.height/2 lines, we can still move each duplicated layer without them being locked up and also have a time offset.
    Cool!

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