Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

 
uroshp
Topic Author
Posts: 5
Joined: Tue Mar 25, 2008 4:33 pm

Distance from camera determining the scale of an object

Wed Mar 26, 2008 7:39 am

Hey guys,

I've been roaming through this forum for quite some time and never needed to ask questions because i would always find the answer on here until now.

When it comes to expressions and JAVA i am a complete dumb dumb so any help would be really appreciated.

I made a simple diagram of my simplified setup so you guys can understand better. I am trying to achieve the "dock" magnifying effect. The layers are distributed in a circle and are parented to a null that rotates in front of the camera.

What i'm trying to achieve is as the layers that rotate in front of the camera should increase in size-- let's say by 30% and as the move away from it decrease to their original size.

My logic tells me that i have an expression in the size property of each layer that will calculate the distance between the camera and the layer and when it reaches it's shortest distance the scale should be 130%- and as it rotates away it should decrease in size.

Thanks in advance guys!
'ava good one
U.
Attachments
img.jpg
img.jpg (60.92 KiB) Viewed 2793 times
 
Dan Ebberts
Posts: 318
Joined: Sat Jun 26, 2004 10:01 am
Location: Folsom, CA
Contact:

Re: Distance from camera determining the scale of an object

Wed Mar 26, 2008 3:07 pm

Something like this should work:

farDist = 1000;
nearDist = 800;
farScale = [100,100];
nearScale = [130,130];
c = thisComp.activeCamera;
d = length(c.toWorld([0,0,0]), toWorld(anchorPoint))
ease(d, nearDist, farDist, nearScale, farScale)


Adjust nearDist and farDist until it works the way you want.

Dan
 
uroshp
Topic Author
Posts: 5
Joined: Tue Mar 25, 2008 4:33 pm

Re: Distance from camera determining the scale of an object

Thu Mar 27, 2008 1:47 pm

Dan Ebberts wrote:
Something like this should work:

farDist = 1000;
nearDist = 800;
farScale = [100,100];
nearScale = [130,130];
c = thisComp.activeCamera;
d = length(c.toWorld([0,0,0]), toWorld(anchorPoint))
ease(d, nearDist, farDist, nearScale, farScale)


Adjust nearDist and farDist until it works the way you want.

Dan


Hey Dan!,
thanks for your help and sorry it took me for ever to get back to you!
YES!! it works!! thank you so much

man, you guys are amazing!
I am planning to start trying to understand expressions so you'll see me on here with plenty of questions :lol: :lol:

until next time- take care
U.P

Who is online

Users browsing this forum: No registered users and 2 guests