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

Setting a delay on an expression for a countdown

Community Beginner ,
Sep 20, 2023 Sep 20, 2023

Copy link to clipboard

Copied

Hello, I am a newbie when it comes to expression.  I have a piece of code I got from a YouTube video that looks like this:

 

st = 300;
t = st - time;
if (t>599.999) {
c = timeToTimecode(t);
c = c.substring(3,8);
} else
if (t>1) {
c = timeToTimecode(t);
c = c.substring(4,8)
} else {
t = 0
c = timeToTimecode(t);
c = c.substring(4,8);
}

 

But what I want to add is a way to add a delay to the start of the countdown, just like what this guy did with his video.  Electric - 5 Minute Countdown 

 

Also yes, I am using the same effect he is, he made a tutorial video on it, but the video does not include on how to delay the start of the coutndown while keeping the electric animation animating.  How would I do that?

 

If you need to, here's his Tutorial Video 

 

Thank you in advaice for your help.

TOPICS
Error or problem , Expressions , Scripting

Views

287

Translate

Translate

Report

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 , Sep 20, 2023 Sep 20, 2023

I'm not sure if this is what you're asking for, but this example would delay the countdown for 3 seconds:

delay = 3;
st = 300;
t = time > delay ? st - (time-delay) : st;
if (t>599.999) {
c = timeToTimecode(t);
c = c.substring(3,8);
} else
if (t>1) {
c = timeToTimecode(t);
c = c.substring(4,8)
} else {
t = 0
c = timeToTimecode(t);
c = c.substring(4,8);
}

Votes

Translate

Translate
Community Expert ,
Sep 20, 2023 Sep 20, 2023

Copy link to clipboard

Copied

I'm not sure if this is what you're asking for, but this example would delay the countdown for 3 seconds:

delay = 3;
st = 300;
t = time > delay ? st - (time-delay) : st;
if (t>599.999) {
c = timeToTimecode(t);
c = c.substring(3,8);
} else
if (t>1) {
c = timeToTimecode(t);
c = c.substring(4,8)
} else {
t = 0
c = timeToTimecode(t);
c = c.substring(4,8);
}

Votes

Translate

Translate

Report

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 ,
Sep 20, 2023 Sep 20, 2023

Copy link to clipboard

Copied

That is EXACTLY what I am looking for, thank you so much.

Votes

Translate

Translate

Report

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 ,
Sep 20, 2023 Sep 20, 2023

Copy link to clipboard

Copied

That is EXACTLY what I am looking for, thank you so much! However, I am having one small issue.  At the end of the video, the timer disappears at the 2 second mark, bsically the video goes black.  So what do I need to fix in the code to prevent that from happening and also, I would like to add to the code where the timer just sits at 0:00 all the way to the end of the comp because I am going to add 5 seconds to the end of it because I am using this timer for my streams and have a stinger transition when the countdown is finished.  

 

I have attached the file to this replay so you may take a look at it yourself, I am currently working with the blue comp version. Once I have everything I need, I am going to copy it over to the other colors and take it from there with Premiere Pro.  

Votes

Translate

Translate

Report

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 ,
Sep 20, 2023 Sep 20, 2023

Copy link to clipboard

Copied

The expression should work fine as long as the comp is longer than the duration of the count plus the delay. So if your comp was 6 minutes long, the counter should reach 0:00 at 5 minutes and 3 seconds and hold that until the end of the comp.

Votes

Translate

Translate

Report

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 ,
Sep 20, 2023 Sep 20, 2023

Copy link to clipboard

Copied

Got it, but the countdown is disappearing after the 0:02 mark in the comp.  Do I need to re do the comp to make it work?  

Votes

Translate

Translate

Report

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 ,
Sep 20, 2023 Sep 20, 2023

Copy link to clipboard

Copied

I'm not sure, but the comp I'm looking at is only 5 minutes long, which is not long enough for a 5-minute countdown with a 3-second delay.

Votes

Translate

Translate

Report

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 ,
Sep 21, 2023 Sep 21, 2023

Copy link to clipboard

Copied

I am making changes to the blue one or the one name Electric blue then will apply the changes to the rest.  I have uploaded an older version of the file, I am going to send the updated file to this one to show you what I mean.  But as I am writing this code, I thik I may need to readjust the expression to 303 at line 2 of the code st = 300;.

 

But the comp that you will see is the one I am working with for now and will apply the changes to the other comps once we've figured out what is needed to prevent the video from disappearing at 2 seconds to go and display 0:00 at the end of the video for the remainder of the 1 minute left of the video as I have changed the comp to 6 minutes as oppose to 5 minutes now.  (See updated attached file)

Votes

Translate

Translate

Report

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 ,
Sep 21, 2023 Sep 21, 2023

Copy link to clipboard

Copied

LATEST

Okay, I have figured the problem for the ending of the video and that was I had to make a new comp that already started out with the length I want before putting in the expression and adding the effects.  

 

I really appreciate the effort you have put forth in assisting me, thank you very much.

Votes

Translate

Translate

Report

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