Distance from camera determining the scale of an object

Moderators: Disciple, zlovatt

Post Reply
uroshp
Posts: 5
Joined: March 25th, 2008, 4:33 pm

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 9169 times
Dan Ebberts
Posts: 320
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

Something like this should work:

Code: Select all

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
Posts: 5
Joined: March 25th, 2008, 4:33 pm

Dan Ebberts wrote:Something like this should work:

Code: Select all

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
Post Reply