Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Camera Auto Focus Between Text Layers

  • Camera Auto Focus Between Text Layers

    Posted by Cory Van dorn on November 24, 2015 at 3:18 am

    I’m looking to have the camera autofocus between two text layers.

    The camera is dollying forward slowly and I don’t want to key-frame constantly (not linear movement either).
    This is what I have so far which works for piece one.

    Still need the camera to then focus smoothly between the two text layers.

    Thanks,

    -CVD

    target = thisComp.layer("Productions");
    v1 = target.toWorld(target.anchorPoint) - toWorld([0,0,0]);
    v2 = toWorldVec([0,0,1]);
    dot(v1,v2)

    Cory Van dorn replied 10 years, 10 months ago 2 Members · 3 Replies
  • 3 Replies
  • Cory Van dorn

    November 24, 2015 at 4:11 am

    So now I’ve got two sliders each with the auto focus on, if I type a or b the camera focus switches between the two layers.

    I need to key-frame the switch and it needs to be gradual.

    How do I do that? Inexperienced expressionist here.

    a = thisComp.layer("Camera Focus").effect("Title Focus")("Slider")
    b = thisComp.layer("Camera Focus").effect("Productions Focus")("Slider")

  • Kalleheikki Kannisto

    November 24, 2015 at 8:03 am

    Add another slider (to the camera itself in below example) that changes the value from a to b:

    c = effect("Slider Control")("Slider");
    f = linear(c, 0, 100, a,b)

    (f = focus)

    This code goes below your existing code.

    Then you can animate the slider control to change the value smoothly.

  • Cory Van dorn

    November 24, 2015 at 5:02 pm

    This worked beautifully! Final expression on the camera focus distance. Thank you so much.

    a = thisComp.layer("Camera Focus").effect("Title Focus")("Slider")
    b = thisComp.layer("Camera Focus").effect("Productions Focus")("Slider")

    c = thisComp.layer("Camera Focus").effect("Slider Control")("Slider");
    f = linear(c, 0, 100, a,b)

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