Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
ADOBE AFTER EFFECTS:HomeForumBasicsExpressionsTutorialsPodcastsAE TechniquesTrainingCreative Cloud DebateFAQ

Accesing composition layers position

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook
Tomas BumbulevičiusAccesing composition layers position
by on Jun 3, 2012 at 10:00:07 pm

Hello,

I am trying to make an expression, which would take picture from composition "layer_1" and move it from one corner of the screen to another in main comp. 1st layer go to the next corner, 2nd layer start moving near first one, then third one starts.. coordinates are just optional.

The reason why I am asking for help, is because I am not sure whether it is possible to do so as I want. In composition "layer_1" there are 4 layers with pictures, but no matter what layer index I put into layer(i), it still shows me the first one... So maybe layers length should be different, from marker to market... or what?

Could someone give me a shot whether I am doing something wrong?

Thanks.

x1=width-width/9;
y1=50;

x2=50;
y2=height-130;


timeInterval = 90;
startPosition = [x1,y1,0];
endPosition = [x2,y2,0];


for (i = 1; i &lt;=comp("layer_1").numLayers; i++){
comp("layer_1").layer(i).position;
linear(time,0,0+framesToTime(timeInterval),startPosition,endPosition);
}


Return to posts index
Reply   Like  

Dan EbbertsRe: Accesing composition layers position
by on Jun 4, 2012 at 12:12:15 am

It's not exactly clear to me what you're trying to do, and if you already know this, I apologize, but a single expression can only affect the property to which it is applied. It appears that you want one expression to affect multiple layers, but you'll have to apply an expression to each layer.

Dan



Return to posts index
Reply   Like  

Tomas BumbulevičiusRe: Accesing composition layers position
by on Jun 4, 2012 at 7:28:09 am

This is why I was asking for help, because I was not sure whether if is possible at all to make it work.

Here i will try to explain better:

There is a composition "Layer_1", which contains 4 layers. By writing this line (comp("layer_1").layer(i).position), I hoped that i can access each of compositions layer by index. Is it not possible? And the reason why Im doing this, is because I want pictures to slide from one corner of the screen to another in a period of time(chosen this method, because there can be not constant amount of pictures). For now I am trying to accomplish only this step, to do not make it too complex, but it might be that Im trying to do what is impossible.

If this way is bad, could you try to suggest me another algorithm?

Thanks.


Return to posts index
Reply   Like  



Dan EbbertsRe: Accesing composition layers position
by on Jun 4, 2012 at 3:25:18 pm

>I hoped that i can access each of compositions layer by index. Is it not possible?

You can access layers that way, you just can't change anything. If you want to change something, the expression has to be on that layer's property. You can, however, set up an expression to do something different, depending on its own layer index, so your expression could do something like this:

w = thisComp.width;
h = thisComp.height;

p0 = [width/2,height/2];
p1 = [w-width/2,height/2];
p2 = [w-width/2,h-height/2];
p3 = [width/2,h-height/2];

startPos = [p0,p1,p2,p3];
endPos = [p1,p2,p3,p0];
myStartPos = startPos[index-1];
myEndPos = endPos[index-1];
ease(time,0,1.5,myStartPos,myEndPos)

You would apply this to Position property of the first four layers in the comp, and it would cause each to move to a different corner.

I hope that gets you headed in the right direction.

Dan



Return to posts index
Reply   Like  
+1

Tomas BumbulevičiusRe: Accesing composition layers position
by on Jun 5, 2012 at 12:20:46 pm

"You can access layers that way, you just can't change anything. If you want to change something, the expression has to be on that layer's property"

This is the key what I was trying to figure out. Your example is helpful too, thanks for the help!


Return to posts index
Reply   Like  

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook


FORUMSTUTORIALSMAGAZINESTOCKYARDVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2013 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]