Answers.Body: <p>If you want to link certain properties through several composition you can only do this with expressions. They are really not difficult though and its a matter of 1-2 lines.</p>
  
  <p>F.e. to get the position of a layer in a different composition you can do this:</p>
  
  <pre><code>comp("Comp Name").layer("Layer Name").transform.position
  </code></pre>
  
  <p>Just alt click the position stop watch of the layer you want to apply that position to and enter that command.
  To break it down. This select first the comp you want by name and then selects the layer you want within that comp:</p>
  
  <pre><code>comp("Comp Name").layer("Layer Name")
  </code></pre>
  
  <p>This part says that you want a value from the <code>transform</code> menu and the name of the value is <code>position</code>. Position could also just be rotation or any other property:</p>
  
  <pre><code>.transform.position
  </code></pre>
  
  <p>Note that you often get multiple values at once. For example position can have 2 or 3 values depending on if the layer is 2D or 3D. This multiple values are given to you in something called an array or vector. What comes now is only needed if you want independent axis control and not the position value of all 2 or 3 axis's applied to your layer.
  So in order to f.e. only get the position of the y axis you can do this:</p>
  
  <pre><code>y  = comp("Comp 1").layer("layer1").transform.position[1];
  [transform.position[0],y]
  </code></pre>
  
  <p>The made-up variable name y in this case is getting the y-axis value of <code>layer1</code> assigned. by adding <code>[1]</code> at the end of <code>position</code>. Using <code>[0]</code> would give you x and <code>[2]</code> would give you z.</p>
  
  <p>This part is what you call the return value. You write it in the form of an array/vector. Meaning <code>[x-axis-value,y-axis-value]</code> or <code>[x-axis,y-axis,z-axis]</code>. <code>transform.position[0]</code> just means I want the x value of THIS layer where I'm entering the expression in. So you can still control that axis manually.</p>
  
  <pre><code>[transform.position[0],y]
  </code></pre>
  
  <p>In order to account for the time remap you would need to apply the same remapping to comp2 that you applied to comp1.
  If that's not what you are after I might have to see an example project.</p>
  
  <p><strong>Edit:</strong> So if you use time remap to loop layers and not to fine tune your animation you shouldn't use it in these situation. In order to retain a better control you should use a simple expression on the animated assets of your looping composition in order to loop you animation.</p>
  
  <pre><code>loopOut(type = "cycle", numKeyFrame = 0);
  </code></pre>
  
  <p>Add this to every layer property that is animated and make the comp length as long as you need, your 2 second animation will now repeat as long as your composition is, you just have to stretch your layers length to the new comp length. This solves your issue.</p>
  
  <p>If you have more sub-comps in you sub-comp you will have to increase their length as well of course so you can stretch them to the end of their parent comp.</p>
  
  <p>For more information on this expression have a look at this: <a href="http://provideocoalition.com/pvcexclusive/story/expression_shorts_-_loop" rel="nofollow">http://provideocoalition.com/pvcexclusive/story/expression_shorts_-_loop</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-16T07:46:30.927Z
Answers.Text: So I add the expressions to the animated properties as expressions, right?
Answers.UserDisplayName: Gokce Ozan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-16T23:24:41.423Z
Answers.Text: Correct. It wont remove any of your keyframes but take them and loop them forever. All you need to do is increase the length of the layer as needed and it will loop the animation as long as you layer is long.
Answers.UserDisplayName: timonsku
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-10T15:21:23.383Z
Answers.Text: We tried exactly that. But the problem with that is that does not work properly in time remapped comp. Time remapped comp has only 2 seconds of animation. So after 2 seconds, there is no value in ".transform.position".
Answers.UserDisplayName: Gokce Ozan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-10T17:55:50.627Z
Answers.Text: Then just time remap the comp2 in the same manner?
Answers.UserDisplayName: timonsku
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-10T20:09:29.257Z
Answers.Text: I looked into you comp. Am I correct assuming that you only time remap in order to loop your animation?
Answers.UserDisplayName: timonsku
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-10T20:28:12.047Z
Answers.Text: I edited my answer, I tried that method on your project and the face wobbles along just fine after the 2 second mark.
Answers.UserDisplayName: timonsku
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-10T23:52:20.663Z
Answers.Text: While the loopout expression is better, to use the value of the property at an arbitrary time you can use valueAtTime. This does what it says on the tin: **myProperty.valueAtTime(t)** returns the value of the property *myProperty* at the time *t*. Now the property you want is the position of the other layer, and the time you want is the value of the time remapping of the current layer (timeRemap), so in the expression above you'd use **comp("Comp Name").layer("Layer Name").transform.position.valueAtTime(timeRemap)**
Answers.UserDisplayName: stib
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-11T08:18:51.527Z
Answers.Text: Thanks everyone. But it still doesn't cut it. So if I do not use that expression on timeRemap, then where can I put that? As you can see, we use that expression in our loops. But expression is in time remap. Also, I can't exacty add loopout expression to assets, because we are using a rigged null-controlled ik puppet. I can not add timeremap to nulls.
Answers.UserDisplayName: Gokce Ozan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-11T22:54:27.813Z
Answers.Text: No no you don't add time remap to anything. You just add it to every layer that has keyframes and they layer will loop these keyframes forever with that expression. You use it instead of time remap and use it on the layers in your comp instead of the comp itself.
Answers.UserDisplayName: timonsku
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-10T15:12:22.290Z
Answers.LastActivityDate: 2014-12-10T20:34:36.120Z
Answers.LastEditDate: 2014-12-10T20:34:36.120Z
Answers.UserDisplayName: timonsku
Body: <p>So we are making a 2D animation. We have character assets in PSD. </p>
  
  <p>We have a "Character" Comp which contains the following: "Eyes" Comp, "Mouth" Comp and "Body" Comp.
  "Body" has the 2-second walk-cycle of the character. Which is time-remapped to a loop in "Character". But as character walks, its body goes in a wawy upwards and downwards motion.
  The problem starts there: We have to sync "Eyes" and "Mouth" to body's up and down motion. Parenting the said layers' position to the body asset's position is not an option, because the body asset has only 2 seconds of animation. After that, "Mouth" and "Eyes" just stops wherever they were.</p>
  
  <p>I think there must be a way to do this with expressions. But since we are not a code-savvy studio, we can't sit down and write one.</p>
  
  <p>How can we achieve such a goal?</p>
  
  <p>Thanks for the help.</p>
  
  <p>Edit:
  You can download our comp from here: <a href="http://www.mediafire.com/download/v255kgid7ej56m0/walk.zip" rel="nofollow">http://www.mediafire.com/download/v255kgid7ej56m0/walk.zip</a></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-12-10T14:34:47.650Z
Comments.Text: So, to understand you correctly. You have 2 comps in a main comp and comp 1 has animated assets inside itself and you then went ahead and time remapped comp 1 inside the main comp and now need to sync the motion of comp 1 to comp 2? (not an asset inside comp 2?)
  It might be helpful if you could upload a simple AE file that shows the issue.
Comments.UserDisplayName: timonsku
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-12-10T14:43:40.267Z
Comments.Text: Comp 1 has animated assets inside and it is time remapped inside main comp, yes. Comp 1 in Main Comp does not have any motion there. I want to sync Comp 2's motion (position) to a asset's inside Comp 1. Will provide the AEP file asap.
Comments.UserDisplayName: Gokce Ozan
Tags: <after-effects><after-effects-expressions>
Title: How to Sync a Layer's Position, to a Layer in Another (Time Remapped) Comp
UserDisplayName: Gokce Ozan
ThreadText: # How to Sync a Layer's Position, to a Layer in Another (Time Remapped) Comp
  
  (Asked by: username_0 on 2014-12-10)
  
  So we are making a 2D animation. We have character assets in PSD.
  
  We have a "Character" Comp which contains the following: "Eyes" Comp, "Mouth" Comp and "Body" Comp.
  "Body" has the 2-second walk-cycle of the character. Which is time-remapped to a loop in "Character". But as character walks, its body goes in a wawy upwards and downwards motion.
  The problem starts there: We have to sync "Eyes" and "Mouth" to body's up and down motion. Parenting the said layers' position to the body asset's position is not an option, because the body asset has only 2 seconds of animation. After that, "Mouth" and "Eyes" just stops wherever they were.
  
  I think there must be a way to do this with expressions. But since we are not a code-savvy studio, we can't sit down and write one.
  
  How can we achieve such a goal?
  
  Thanks for the help.
  
  Edit:
  You can download our comp from here: <http://www.mediafire.com/download/v255kgid7ej56m0/walk.zip>
  
  **Tags:** after-effects, after-effects-expressions
  
  > **Comments:**
  > **username_1**: So, to understand you correctly. You have 2 comps in a main comp and comp 1 has animated assets inside itself and you then went ahead and time remapped comp 1 inside the main comp and now need to sync the motion of comp 1 to comp 2? (not an asset inside comp 2?) It might be helpful if you could upload a simple AE file that shows the issue.  
  > **username_0**: Comp 1 has animated assets inside and it is time remapped inside main comp, yes. Comp 1 in Main Comp does not have any motion there. I want to sync Comp 2's motion (position) to a asset's inside Comp 1. Will provide the AEP file asap.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-12-10. Score: 3
  
  If you want to link certain properties through several composition you can only do this with expressions. They are really not difficult though and its a matter of 1-2 lines.
  
  F.e. to get the position of a layer in a different composition you can do this:
  
  ```
  comp("Comp Name").layer("Layer Name").transform.position
  
  ```
  
  Just alt click the position stop watch of the layer you want to apply that position to and enter that command.
  To break it down. This select first the comp you want by name and then selects the layer you want within that comp:
  
  ```
  comp("Comp Name").layer("Layer Name")
  
  ```
  
  This part says that you want a value from the `transform` menu and the name of the value is `position`. Position could also just be rotation or any other property:
  
  ```
  .transform.position
  
  ```
  
  Note that you often get multiple values at once. For example position can have 2 or 3 values depending on if the layer is 2D or 3D. This multiple values are given to you in something called an array or vector. What comes now is only needed if you want independent axis control and not the position value of all 2 or 3 axis's applied to your layer.
  So in order to f.e. only get the position of the y axis you can do this:
  
  ```
  y  = comp("Comp 1").layer("layer1").transform.position[1];
  [transform.position[0],y]
  
  ```
  
  The made-up variable name y in this case is getting the y-axis value of `layer1` assigned. by adding `[1]` at the end of `position`. Using `[0]` would give you x and `[2]` would give you z.
  
  This part is what you call the return value. You write it in the form of an array/vector. Meaning `[x-axis-value,y-axis-value]` or `[x-axis,y-axis,z-axis]`. `transform.position[0]` just means I want the x value of THIS layer where I'm entering the expression in. So you can still control that axis manually.
  
  ```
  [transform.position[0],y]
  
  ```
  
  In order to account for the time remap you would need to apply the same remapping to comp2 that you applied to comp1.
  If that's not what you are after I might have to see an example project.
  
  **Edit:** So if you use time remap to loop layers and not to fine tune your animation you shouldn't use it in these situation. In order to retain a better control you should use a simple expression on the animated assets of your looping composition in order to loop you animation.
  
  ```
  loopOut(type = "cycle", numKeyFrame = 0);
  
  ```
  
  Add this to every layer property that is animated and make the comp length as long as you need, your 2 second animation will now repeat as long as your composition is, you just have to stretch your layers length to the new comp length. This solves your issue.
  
  If you have more sub-comps in you sub-comp you will have to increase their length as well of course so you can stretch them to the end of their parent comp.
  
  For more information on this expression have a look at this: <http://provideocoalition.com/pvcexclusive/story/expression_shorts_-_loop>
  
  > **Comments:**
  > **username_0**: We tried exactly that. But the problem with that is that does not work properly in time remapped comp. Time remapped comp has only 2 seconds of animation. So after 2 seconds, there is no value in ".transform.position".  
  > **username_1**: Then just time remap the comp2 in the same manner?  
  > **username_1**: I looked into you comp. Am I correct assuming that you only time remap in order to loop your animation?  
  > **username_1**: I edited my answer, I tried that method on your project and the face wobbles along just fine after the 2 second mark.  
  > **username_2**: While the loopout expression is better, to use the value of the property at an arbitrary time you can use valueAtTime. This does what it says on the tin: **myProperty.valueAtTime(t)** returns the value of the property *myProperty* at the time *t*. Now the property you want is the position of the other layer, and the time you want is the value of the time remapping of the current layer (timeRemap), so in the expression above you'd use **comp("Comp Name").layer("Layer Name").transform.position.valueAtTime(timeRemap)**  
  > **username_0**: Thanks everyone. But it still doesn't cut it. So if I do not use that expression on timeRemap, then where can I put that? As you can see, we use that expression in our loops. But expression is in time remap. Also, I can't exacty add loopout expression to assets, because we are using a rigged null-controlled ik puppet. I can not add timeremap to nulls.  
  > **username_1**: No no you don't add time remap to anything. You just add it to every layer that has keyframes and they layer will loop these keyframes forever with that expression. You use it instead of time remap and use it on the layers in your comp instead of the comp itself.  
  > **username_0**: So I add the expressions to the animated properties as expressions, right?  
  > **username_1**: Correct. It wont remove any of your keyframes but take them and loop them forever. All you need to do is increase the length of the layer as needed and it will loop the animation as long as you layer is long.  
  
  ---
  
  