Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Stopping Expressions to regain control of an object

  • Stopping Expressions to regain control of an object

    Posted by Bryan Nieman on January 3, 2008 at 4:08 pm

    Hello!

    I am working on an animation where I have a camera’s position being calculated by an expression. At a certain point in the animation I would like to regain control of the camera so I can position and keyframe the camera myself.

    Is this possible?

    If not, is there a way I can dynamically take an instantaneous reading of the camera’s position and create a new active camera which would start where the first camera left off?

    Please keep in mind I am not an After Effects expert and only use it as needed. I typically work in Premiere, Flash, Photoshop, and Illustrator.

    Cheers,
    Bryan

    Kyle Hamrick replied 18 years, 4 months ago 4 Members · 6 Replies
  • 6 Replies
  • Noah Poole

    January 3, 2008 at 5:55 pm

    I’m no expression wizard, but I think I have a solution. You’ll need to tell it to use your expression if the comp time is less than where you want it to stop.

    if (time < 1){; (wiggle(5,7)); }else{; transform.position} time < 1 is saying only do the wiggle before the 1 second mark. transform.position is saying to use whatever position keyframes are set. Sorry if I'm not explaining that well, but if you plug in your expression instead of the wiggle that should work.

  • Mike Clasby

    January 3, 2008 at 6:10 pm

    You could just Split the Camera layer and then deactivate the expression, or use one of the three solutions below; expression on/off at a given frame, with a checkbox, or at given keyframes.

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

    startFrame = 145;
    stopFrame = 241;

    if (time >= framesToTime(startFrame) && time < framesToTime(stopFrame)){ wiggle (5,20) }else{ value } ----------------------------- Name: Dan Ebberts Date: Jun 13, 2006 at 9:39:46 am Subject: Re: animating expression on/off On way is to apply a checkbox control to your layer, keyframe the control on and off, and add an expression like this to your property: control = effect("Checkbox Control")("Checkbox") ; if (control == 1){ wiggle(5,50); // your expression goes here }else{ value; } Dan ----------------------------------------- Name: julian06 Date: Dec 15, 2006 at 10:17:53 pm Subject: Re: Start Expression after certain frame hi let's assume that keyframe 1 is at frame 60 and the second on is at frame 240. Now add this expression if (time >= key(1).time&& time<=key(2).time) { wiggle(1,50) } else{ value }

  • Mike Clasby

    January 3, 2008 at 6:16 pm

    Also… maybe this is a little easier, as you could slide the marker around as needed.

    Marker Kills Expression
    Set a marker with the asterisk key on the numeric pad.

    n = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time){
    n–;
    }
    }

    if (n == 0){

    //your expression here

    }else{
    value;
    }

  • Bryan Nieman

    January 3, 2008 at 6:35 pm

    Thanks for the quick response!

    When I deactivate the expression on the new camera it loses the values from the previous frame. Is there a way to copy the calculated values from the initial camera?

  • Bryan Nieman

    January 3, 2008 at 7:28 pm

    Thank you everyone! Great insight 🙂

    I finally got a grasp on using key frames with expressions. Using if statements was the way to go for me but the other solutions are nice too 🙂

    Take care,
    Bryan

  • Kyle Hamrick

    January 3, 2008 at 9:50 pm

    Depending on the situation, I tend to use slider controls for a variable I might want to do away with later (and/or change easily).

    They’re easy to set up – pretty much just pickwhipping, and it’s pretty easy to make sure your object won’t “jump” when the expression is ended.

    Kyle Hamrick

    Editor/Motion Graphics Artist

    http://www.kylehamrick.com

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