value change when Null getting closer to layer

Moderators: Disciple, zlovatt

Post Reply
madli
Posts: 7
Joined: March 12th, 2007, 3:37 am

hi to all expression jedi...

Is there any expression that effect layer properties eg: opacity or scale, when null getting closer to layer position. Its more like tsunami menu in flash.

layer fade in..when the null getting closer, and layer fade out.. when the null get far from layer.. and the opacity in and out calculated according the distant value between the null n object...

see the attachment file i got from net. i think u got what i mean...
please help me!! :oops: , thank you...

madli
Attachments
Repelling and Attracting.rar
example affect position
(9.1 KiB) Downloaded 768 times
kobyg
Posts: 128
Joined: December 7th, 2007, 10:11 am

Try applying the following expression to the opacity.

Code: Select all

D_opaq = 100;
D_trans = 300;
d = length(position, thisComp.layer("Avoid Me").transform.position);
ease(d, D_opaq, D_trans, 100, 0)
It will keep the layer transparent as long as the Null ("Avoid Me") is farther from the layer by "D_trans" or more pixels,
and will gradually increase the opacity as the Null gets closer to the layer, until 100% opacity will be achieved
when the distance between the layer and the Null is "D_opaq" or less pixels.

Koby.
madli
Posts: 7
Joined: March 12th, 2007, 3:37 am

thanks koby,

Its worked. thank you very much. im happy. :D
but cant apply to scale properties.

madli
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

That's probably because Scale is a 2 dimensional property so the result needs to be in the form of [xValue, yValue]. Try this:

Code: Select all

D_opaq = 100;
D_trans = 300;
d = length(position, thisComp.layer("Avoid Me").transform.position);
result = ease(d, D_opaq, D_trans, 100, 0);
[result, result]
madli
Posts: 7
Joined: March 12th, 2007, 3:37 am

many thankss...hehe! love u guys.
Post Reply