Skip to main content
barbarah92217474
Participant
Nov 14, 2024 12:03 PM UTC
Answered

Delay multiple comps with random start times

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]

 

This topic is closed to new replies. Start a new post to keep the conversation going.
barbarah92217474
barbarah92217474Correct answer
Participant
Nov 14, 2024 1:29 PM UTC

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]

4 replies

Legend
Nov 14, 2024 12:51 PM UTC

 

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
barbarah92217474
barbarah92217474AuthorCorrect answer
Participant
Nov 14, 2024 1:29 PM UTC

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]

Translate
Legend
Nov 14, 2024 1:55 PM UTC
delay = Number(name.split(' ')[1]) - 1;
time - delay

Should be enough

Translate