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

Delay multiple comps with random start times

Community Beginner ,
Nov 14, 2024 Nov 14, 2024

Hi,

 

I am a complete newbie to AE expressions. I have 24 comps that I don't want them all to start to play at the same time, I would like them to start randomly, essentially randomly delay each comp by a few seconds. I don't want to stagger the comps as the project may grow and I would rather use an expression if possible.

 

I found the code below but I am getting an error. Can someone please advise me? Any help would be greatly appreciated.

//time remap

delay = 5;

framerate = 25;

n = name - 1;

d = n*(delay)/framerate;

t = thisLayer.timeRemap.valueAtTime(time-d);

[t]

Screenshot 2024-11-14 at 12.01.03.png

 

TOPICS
Expressions
715
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 Beginner , Nov 14, 2024 Nov 14, 2024

Thank you so much for replying! I have added the code as per below but it doesn't seem to delay the comp playing in any way. Maybe I'm doing something esle wrong or maybe using the wrong approach?

 

//time remap

delay = 5;

framerate = 25;

n = Number(name.split(' ')[1]) - 1;

d = n*(delay)/framerate;

t = thisLayer.timeRemap.valueAtTime(time-d);

[t]

Screenshot 2024-11-14 at 13.28.46.png

Translate
Advocate ,
Nov 14, 2024 Nov 14, 2024

screenshot.png

 

name is the layer’s name, so:

 

n = DAY 1 - 1;

 

can't return a number.

 

You must either rename your layer (1, 2, 3, 4, 5...)

or extract the number from the layer’s name.

 

n = Number(name.split(' ')[1]) - 1;

 

 

 

 

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 Beginner ,
Nov 14, 2024 Nov 14, 2024

Thank you so much for replying! I have added the code as per below but it doesn't seem to delay the comp playing in any way. Maybe I'm doing something esle wrong or maybe using the wrong approach?

 

//time remap

delay = 5;

framerate = 25;

n = Number(name.split(' ')[1]) - 1;

d = n*(delay)/framerate;

t = thisLayer.timeRemap.valueAtTime(time-d);

[t]

Screenshot 2024-11-14 at 13.28.46.png

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
Advocate ,
Nov 14, 2024 Nov 14, 2024
delay = Number(name.split(' ')[1]) - 1;
time - delay

Should be enough

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 Beginner ,
Nov 14, 2024 Nov 14, 2024
LATEST

Perfect, thank you so much for all your help!!!

 

Correct code is below for anyone else:

//time remap

delay = 2;

framerate = 25;

n = Number(name.split(' ')[1]) - 1;

d = n*(delay)/framerate;

t = thisLayer.timeRemap.valueAtTime(time - delay);

[t]

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