FORUMS: list search recent posts

Expression for different focus distances

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Sinan Al-Kurikchi
Expression for different focus distances
on Feb 18, 2015 at 3:08:42 pm

Hi,

I really hope I can put my question the right way here. I want to set an expression so that my camera focus follows an object. I had an expression from VideoCopilot that worked great

length(thisComp.layer("To Follow").transform.position, transform.position)

This works great as long as I just use a single layer. Now I got different layers that should be focused, each at a time. So I wanted to add a layer controller to change the layer like that.

length(thisComp.layer("Controller Focus").effect("Focus")("Layer").transform.position, transform.position)

My problem now is that you can not keyframe this layer controller. So I tried a quite complicated (for my point of knowledge) approach. I made a slider controller and 3 different layer controllers and added that code:

S=thisComp.layer("Controller Focus").effect("Einstellungen für Schieberegler")("Schieberegler").value;
L = Math.round(S);

if (L == 1) F=thisComp.layer("Controller Focus").effect("Inhalt 1")("Ebene");
{
if (L == 2) F=thisComp.layer("Controller Focus").effect("Inhalt 2")("Ebene");

{
if (L == 3) F=thisComp.layer("Controller Focus").effect("Inhalt 3")("Ebene");
}
}


length(thisComp.layer("Inhalt 1").transform.position, transform.position)


My simple question now is just: how do I right my variable that I get from the layer controller into my last part of the script. What kind of value is it that I get. I really hope you understand what I mean.

The master question is: Can anyone give my a better code or more simple approach to my task? Maybe even with a "catch(e)" part that prevents a whole crash of my code.

Thanks in advance


Return to posts index

Dan Ebberts
Re: Expression for different focus distances
on Feb 18, 2015 at 5:25:22 pm

I think you just need to change the last line to this:

length(F.transform.position,transform.position)

Dan



Return to posts index

Sinan Al-Kurikchi
Re: Expression for different focus distances
on Feb 18, 2015 at 5:51:36 pm

Thanks a lot! Works great and you are my new hero :)


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]