ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Re: Link Light intensity to Camera Position

COW Forums : Adobe After Effects Expressions

FAQ   •   VIEW ALL   •   ADD A NEW POST   •   PRINT
Respond to this post   •   Return to posts index   •   Read entire thread


Dan Ebberts
Re: Link Light intensity to Camera Position
on Sep 8, 2018 at 4:38:30 pm

Sometimes expressions will break because the active camera is undefined at times before zero. See if either of these help:


if (time >= 0){
CameraPos = thisComp.activeCamera.toWorld([0,0,0]);
LayerPos = toWorld([0,0,0]);
earthNull = thisComp.layer("Earth Null");
EarthPos = earthNull.toWorld(earthNull.anchorPoint);
v1 = CameraPos - EarthPos;
v2 = LayerPos - EarthPos;
angle = radiansToDegrees(Math.acos(dot(normalize(v1),normalize(v2))));
linear(angle,85,95,100,0);
}else{
value;
}



try{
CameraPos = thisComp.activeCamera.toWorld([0,0,0]);
LayerPos = toWorld([0,0,0]);
earthNull = thisComp.layer("Earth Null");
EarthPos = earthNull.toWorld(earthNull.anchorPoint);
v1 = CameraPos - EarthPos;
v2 = LayerPos - EarthPos;
angle = radiansToDegrees(Math.acos(dot(normalize(v1),normalize(v2))));
linear(angle,85,95,100,0);
}catch(e){
value;
}



Dan



Posts IndexRead Thread 


Current Message Thread:





podcasts
© 2019 CreativeCOW.net All Rights Reserved
[TOP]