FORUMS: list search recent posts

Opacity linked to the co-ordinates of another layer

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Chris Craig
Opacity linked to the co-ordinates of another layer
on Apr 17, 2014 at 2:21:59 am

Hello Everyone.

Please forgive my lack of expression knowledge.

Im recreating an iphone swiping (left-right) function where I have a wide precomp inside a small master comp and with every swipe, it reveals a different animation. The dots underneath indicate how many screens there are to swipe through and where that screen is in relation to the others (beginning, middle, end etc)

What i have is 6 small circles all lined up and evenly distributed horizontally. The idea is that each individual circle is at 100% when the precomp layer above is at a specified x position. The master comp is 640px wide and so at 0,568, my first dot is fully opaque. When the precomp is at -640, 568, circle 1 has faded out over 4 frames and circle 2 fades in and so on for another 5 screens at x positions (-1280/-1920/-2560/-3200/-3840)

I appreciate any assistance you can provide,

Thanks very much
Chris


Return to posts index

Dan Ebberts
Re: Opacity linked to the co-ordinates of another layer
on Apr 17, 2014 at 4:32:25 pm

I'm having trouble picturing your scene. Does the precomp move continuously at a constant speed? I think it would be easy to set up if everything is a linear calculation based on how fast the precomp is moving. If that's not the case, it becomes trickier because each expression needs to find the particular frame that triggers its 4-frame fade. Do-able, but not as easy.

Dan



Return to posts index

Chris Craig
Re: Opacity linked to the co-ordinates of another layer
on Apr 17, 2014 at 8:40:49 pm

Sorry Dan. I'll try and be a little clearer.

I have an iPhone image. Within the screen of the iPhone is a wide precomp with photos every 640 pixels. When the hand comes in to swipe the screen the precomp moves 640 pixels to reveal the next photo . The animation will stop here until the hand comes in and swipes left or right for the next or previous photo.

If there are 6 photos in the precomp, there will be 6 little circles ( all seperate layers ) evenly distributed horizontally at the bottom of the iPhone screen. The first circle is already 100% opacity , but as the precomp slides away , the first circle fades out to 0, and as the next photo eases into its position the second circle goes from 0-100%

I hope this has made it clearer Dan.


Return to posts index


Dan Ebberts
Re: Opacity linked to the co-ordinates of another layer
on Apr 17, 2014 at 9:01:37 pm

I guess what I'm asking is if you can define the pixel ranges of the precomp x position that corresponds to the fade ramps of each circle. If there's a direct relationship between circle opacity and precomp x-position, that should be pretty easy to set up.

Or is it a timing thing (more complex)?

Dan



Return to posts index

Chris Craig
Re: Opacity linked to the co-ordinates of another layer
on Apr 17, 2014 at 9:13:44 pm

Hi Dan

The precomp is 4480 wide with each photo within it is 640 px wide.

Placed inside the master, i have set the anchor point and position of the X to be 0. So when the precomp is at -640,568 the 2nd photo is on the screen.

The fade ramps can just be based on distance to the x position.


Return to posts index

Dan Ebberts
Re: Opacity linked to the co-ordinates of another layer
on Apr 17, 2014 at 9:23:01 pm

OK, we're getting there. Give me some numbers (x positions for start of fade in, 100%, and end of fade out).

Dan



Return to posts index


Chris Craig
Re: Opacity linked to the co-ordinates of another layer
on Apr 17, 2014 at 9:35:17 pm

Hi Dan

For the fades, lets start with 150 pixels either side of the final positions:

Circle 1: 0,568
Fade out/in: -150, 568

Circle 2: -640,568
Fade in/out: -790,568
Fade in/out: -490, 568

Circle 3: -1280, 568
Fade in/out: -1130,568
Fade in/out: -1430, 568

I can amend the expression with further circle co-ordinates.

Thanks very much Dan


Return to posts index

Dan Ebberts
Re: Opacity linked to the co-ordinates of another layer
on Apr 17, 2014 at 9:47:49 pm

OK, it might be something like this example for the second dot:

x = -640;
delta = 150;
precompX = thisComp.layer("pre-comp").transform.position[0];
d = precompX - x;
easeIn(Math.abs(d),0,delta,100,0)


You'd need to change the first line for each dot (and the name of your precomp, of course).


Dan



Return to posts index

Chris Craig
Re: Opacity linked to the co-ordinates of another layer
on Apr 17, 2014 at 10:23:12 pm

Beautiful. Absolutely wonderful. Thank you very much Dan. It works perfectly.


Return to posts index

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