Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Hey, i need help about parenting layers to a null with a delay

Contributor ,
Feb 20, 2019 Feb 20, 2019

Hey everyone. I am trying to parent several shapes to a null with a delay between them. So i wish to control several layers with only one null.

I asked in AE discord channel and someone helped me with this code

  • p = thisComp.layer("Control");
  • delay = thisComp.layer("Control").effect("Delay")("Slider")/100;
  • value+p.transform.position.valueAtTime(time-delay);

For this code, i have a null named Control with a slider control named Delay. I used this code on shape's position.

This code works but there is a kinda big problem. When i use the expression, my layer moves somewhere else and start to follow my null from that point. I create an example project to explain.

This is what happens when the expression disabled

download.jpg

And this is what happens when the expression enabled

Screenshot_4.png

I am not sure how can i fix this / is it possible to fix. I hope someone can help me : D

(or maybe another way that i can parent layers to a null with delay : )

Thank you for reading.

5.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 20, 2019 Feb 20, 2019

See if this works closer to what you want:

p = thisComp.layer("Control").transform.position;

delay = thisComp.layer("Control").effect("Delay")("Slider")/100;

delta = p.valueAtTime(time-delay) - p.valueAtTime(0);

value+delta;

Dan

Translate
Community Expert ,
Feb 20, 2019 Feb 20, 2019

See if this works closer to what you want:

p = thisComp.layer("Control").transform.position;

delay = thisComp.layer("Control").effect("Delay")("Slider")/100;

delta = p.valueAtTime(time-delay) - p.valueAtTime(0);

value+delta;

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 20, 2019 Feb 20, 2019

Hey Dan, that worked great : )

May i ask you about what did we wrong, what did you do to correct it?

ps. And one more small question, since slider only let me values 0-100, how can i use values more than 100?

Thank you : )

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 20, 2019 Feb 20, 2019

The trick is that you need to add to your follower layer's position, the amount that the control layer has moved since time zero.

For the slider, you can just right click on the value and select Edit Value, where you can enter numbers outside the slider's range, or even change the range.

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 20, 2019 Feb 20, 2019

Hey Dan, thank you very much for the help : D

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 20, 2019 Aug 20, 2019
LATEST

Hey Dan Ebberts, been trying to work something similar out. One question, how do I modify the Delay slider to be the number of frames (to delay)? Is this correct?

p = thisComp.layer("Control").transform.position;

delay = thisComp.layer("Control").effect("Delay")("Slider")*thisComp.frameDuration*(index - 1);

delta = p.valueAtTime(time-delay) - p.valueAtTime(0);

value+delta;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines