Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How can you stop an expression linked to keyframes?

  • How can you stop an expression linked to keyframes?

    Posted by Daniel Haskett on November 14, 2007 at 1:31 am

    Hi there

    ive got a brush position for write on linked to the position of another layer so it can follow this layer.

    however i want it stop half way through so it doesnt copy all the keyframes and just freezes? is this possible? i know i can precompose the layer and then time remap and then freeze it from a certain frame, just wondered if there was a way to do with expressions?

    cheers

    dan

    Dan Ebberts
    replied 18 years, 5 months ago
    3 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    November 14, 2007 at 3:18 am

    Like this:

    stopTime = 2;
    t = Math.min(stopTime,time);
    thisComp.layer(“Layer 1”).transform.position.valueAtTime(t)

    Or, you could do it with a marker, like this:

    stopTime = marker.key(1).time;
    t = Math.min(stopTime,time);
    thisComp.layer(“Layer 1”).transform.position.valueAtTime(t)

    Dan

  • Mike Clasby

    November 14, 2007 at 3:27 am

    Here’s a nifty Dan expression for starting and stopping an expression at a given frame:

    startFrame = 0;
    stopFrame = 241;

    if (time >= framesToTime(startFrame) && time < framesToTime(stopFrame)){ //your expression goes here }else{ value } Set startFrame and endFrame as needed.

  • Mike Clasby

    November 14, 2007 at 3:29 am

    Ooops, didn’t see you Dan. It takes me longer to look stuff up. Oh, well, more options are good, I guess.

  • Daniel Haskett

    November 14, 2007 at 10:18 am

    Hey Dan,

    Thanks for your help, sorry Im still gradually getting to grips with expressions. i tried to use what you said and this is what the expression looks like —

    stopTime = marker.key(1).time;
    t = Math.min(stopTime,time);
    thisComp.layer(“ski dust.psd”).transform.position.valueAtTime(t);
    temp = thisComp.layer(“SKIER FINAL”).transform.position;
    [temp[0], temp[1]+effect(“Slider Control”)(“Slider”)]

    it doesnt seem to work, im sure ive done something wrong. the layer ski dust.psd has its brush position linked to the position keyframes of SKIER FINAL…ive set a marker but still nothing.

    any help would be greatly appreciated!

    thanks

    dan

  • Dan Ebberts

    November 14, 2007 at 2:13 pm

    I guess I don’t understand what you’re trying to do. If you applied this expression:

    stopTime = marker.key(1).time;
    t = Math.min(stopTime,time);
    thisComp.layer(“SKIER FINAL”).transform.position.valueAtTime(t);

    to the brush positiion and create the marker on the layer with the write-on effect, it should do what I thought you wanted.

    I’m not sure what you’re doing with this piece:

    temp = thisComp.layer(“SKIER FINAL”).transform.position;
    [temp[0], temp[1]+effect(“Slider Control”)(“Slider”)]

    Dan

  • Daniel Haskett

    November 14, 2007 at 2:57 pm

    hi dan

    yeh that works better, the second section was so that i could change the x and y co ordinates – i was using a slider control for y….is there anyway this could be incorporated into the expression?

    cheers

    dan

  • Dan Ebberts

    November 14, 2007 at 3:52 pm

    If you want to be able to offset the write-on effect in the y direction with a slider, you could do it like this:

    stopTime = marker.key(1).time;
    t = Math.min(stopTime,time);
    s = effect(“Slider Control”)(“Slider”);
    thisComp.layer(“SKIER FINAL”).transform.position.valueAtTime(t) + [0,s];

    Dan

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