Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Camera movement by expression, stopping at a certain point

  • Camera movement by expression, stopping at a certain point

    Posted by Klemens Hertha on September 11, 2012 at 11:55 am

    Hi guys!

    Again I have a question about expressions, this time really simple I think! Although I still don’t get the result I want…

    I want a slow camera movement over the x-axis which stops as soon as I zoom in with the camera by keyframes and starts over again as soon as the camera zooms out. I’ve tried it with the code below and it works so far except that the camera jumps back to the initial position when I zoom in. (Somehow logical with this code! ;-)) Same goes the other way when zooming out…
    What I’m trying to accomplish is, that as soon as the camera zooms in, it should take the ACTUAL x-value at this time and stop there until I zoom out again – then it should start moving again over the x-axis, beginning from the actual x-value (the x-value from the camera-position-keyframe).

    Thanks for your time!
    Klemens

    x = value[0] + time * 30;
    y = transform.position[1];
    z = transform.position[2];
    x2 = value[0];
    if (z < -1777)
    {[x, y, z]}
    else
    {[x2, y, z]}

    Klemens Hertha replied 13 years, 8 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    September 11, 2012 at 2:18 pm

    It’s not really clear to me what you’re trying to do, so I don’t know if this is an issue, but your expression can’t save any information from one frame to the next. So if you want your expression to pick up where it left off at some time in the past, you have to go back and recalculate the conditions at that time. That probably doesn’t help much–sorry.

    Dan

  • Klemens Hertha

    September 11, 2012 at 3:04 pm

    Hi Dan (again) ;)!

    Sorry, if I didn’t make clear what I’m trying to do!
    I have a collage of pictures which should slowly pass by from left to right by camera movement. Then – at some certain point – I want to zoom in to one specific picture by keyframing the camera so that it is fullscreen. While it is fullscreen (let’s say for 2 sec) the camera should not move! After that I want to zoom back out to the collage by keyframing the camera again. And from here on the camera should move again from left to right with the same speed like before. So if it is not possible to pick up the last x-value before zooming in, what about if I just tell the camera the x-value with the last keyframe from zooming out? Is that possible? Or do you maybe know another way of doing this?

    Regards,
    Klemens

  • Dan Ebberts

    September 11, 2012 at 3:25 pm

    When you say “zoom”, are you talking about animating the Zoom property of the camera, or are you actually moving the camera?

    It sounds like you have a keyframed camera movement and at various points you want to stop, zoom in and out, and then resume the keyframed movement, is that close? If so, how does the expression know when the zoom happens and when it’s done?

    Dan

  • Klemens Hertha

    September 11, 2012 at 3:47 pm

    Ok, sorry, zoom was not correct of course, I’m moving the camera on the z-axis! And this is also how the expression (above) should know when it should start / stop moving – by the “if (z < -1777)”-condition!

    And no, the initial camera-movement (from left to right) is NOT keyframed! This is what I did with the “x = value[0] + (time-3) * 30;”. I have only the z-movement keyframed right now. But when I think about it, it was maybe really the wrong approach… Cause time still passes by when the expression is “disabled” by the if-condition and needless to say the x-value changes too!
    So is there a better (maybe even simpler) way to do this? Sometimes I’m thinking too comlicated… 😉

    Regards,
    Klemens

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