DIGITAL CLOCK / TIMER ANIMATION in After Effects | Easy Timing with Expressions

Поділитися
Вставка
  • Опубліковано 6 жов 2024
  • How to make digital clock effect, counter animation and stopwatch animation easily with a few lines of code without using plugins with After Effects.
    Codes: www.ekinyalgin...
    Font: www.dafont.com...

КОМЕНТАРІ • 32

  • @moggoon
    @moggoon 10 місяців тому

    Brilliant video. I left the background black but with the shadow centred, making it look back lit. It looks great in bright red. Thanks for the tutorial. It was everything I wanted and a whole lot more besides.

  • @jonasmortensen1252
    @jonasmortensen1252 10 місяців тому +4

    Here is a javascript alternative so you dont have to switch to the old extendscript
    rate = 1;
    clockStart = 0;
    function timerg(n) {
    if (n < 10) {
    return "0" + n;
    } else {
    return "" + n;
    }
    }
    clockTime = Math.max(clockStart + rate * (time - inPoint), 0);
    t = Math.floor(clockTime);
    min = Math.floor((t % 3600) / 60);
    sec = Math.floor(t % 60);
    result = min + ":" + timerg(sec);
    result;

  • @ExploreYourself2
    @ExploreYourself2 9 місяців тому +6

    Here's the modified expression that includes hours, minutes, and seconds in double digits, along with AM/PM indication:
    rate = 1;
    clockStart = 0;
    function timerg(n) {
    return (n < 10) ? "0" + n : "" + n;
    }
    clockTime = Math.max(clockStart + rate * (time - inPoint), 0);
    t = Math.floor(clockTime);
    hours = Math.floor(t / 3600);
    min = Math.floor((t % 3600) / 60);
    sec = Math.floor(t % 60);
    // Determine whether it's AM or PM
    ampm = (hours < 12) ? "AM" : "PM";
    // Convert to 12-hour format
    hours = (hours % 12 === 0) ? 12 : hours % 12;
    result = timerg(hours) + ":" + timerg(min) + ":" + timerg(sec) + " " + ampm;
    result;
    This modification calculates whether it's AM or PM based on the hours and converts the hours to a 12-hour format. The result string includes hours, minutes, seconds, and AM/PM indication.

    • @OGDerky
      @OGDerky Місяць тому

      You saved me lot of time, thank you so mcuch

  • @frekhzfaber
    @frekhzfaber 7 місяців тому +2

    Thank you! If you want to add the hours to the clock, you can add this variable line and add it to the text print :
    t = Math.floor(clockTime);
    hou = Math.floor((t/3600));
    min = Math.floor((t%3600)/60);
    sec = Math.floor(t%60);
    hou + ":" + min + ":" + timerg(sec)

    • @JohnsDumpsterFireIsToasty
      @JohnsDumpsterFireIsToasty 5 місяців тому

      Also make sure you add the timerg function to the hours and minutes to get them properly formatted:
      timerg(hou) + ":" + timerg(min) + ":" + timerg(sec);

  • @yourumium8871
    @yourumium8871 3 місяці тому

    Thank you

  • @p.e.t.e.s.o
    @p.e.t.e.s.o Рік тому

    Thank you!!! Just what I was looking for! 👍🏻

  • @david.cervantes
    @david.cervantes 11 місяців тому +1

    Thank you, sir! Quick question: is there a way to advance the timer faster? I'm guessing you need to adjust something on the expression, just -what- that would be is the question

  • @julianvargas7478
    @julianvargas7478 Рік тому

    Excelente, gracias! 😃

  • @robertpatterson6833
    @robertpatterson6833 11 місяців тому +1

    Great video! How would I make the clock start at 4:59:55 as though an alarm clock is counting up to 5pm?

    • @frekhzfaber
      @frekhzfaber 7 місяців тому +2

      4*3600 + 59*60 +55 = clockStart = 17995;
      Add the Hours variable :
      t = Math.floor(clockTime);
      hou = Math.floor((t/3600));
      min = Math.floor((t%3600)/60);
      sec = Math.floor(t%60);
      hou + ":" + min + ":" + timerg(sec)

  • @mqayyubi4268
    @mqayyubi4268 Рік тому

    thank a lot. very usefull

  • @HungryBoy88Years
    @HungryBoy88Years Рік тому

    Thanks mate!

  • @jonasmortensen1252
    @jonasmortensen1252 10 місяців тому

    Also if you use your own font, remember it must be a monospaced font

  • @riffbaama
    @riffbaama Рік тому

    Thankyou very much... How can I set the clock for hours and minutes?

    • @ekin-yalgin
      @ekin-yalgin  2 місяці тому

      Hi! To set the clock for hours and minutes in After Effects, you can modify the expressions used in the tutorial. Instead of using just seconds, you'll need to format the time to include hours and minutes. Here's an example expression:
      clockStart = 0;
      rate = 1;
      timeInSeconds = Math.floor(clockStart + rate * (time - inPoint));
      hours = Math.floor(timeInSeconds / 3600);
      minutes = Math.floor((timeInSeconds % 3600) / 60);
      seconds = Math.floor(timeInSeconds % 60);
      (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds);
      This will display the time in HH:MM format. Adjust the clockStart and rate variables as needed.

  • @ezey2746
    @ezey2746 2 місяці тому

    hi, when i click source text nothing appears on the timeline, please can you tell me how to fix this, thank you

    • @ekin-yalgin
      @ekin-yalgin  2 місяці тому +1

      If nothing appears on the timeline when you click the source text, it's possible that the layer might be locked or not properly selected. Make sure the text layer is unlocked and selected in the timeline panel. Also, try clicking the arrow next to the text layer to expand its properties.

    • @ezey2746
      @ezey2746 2 місяці тому

      @@ekin-yalgin thank you boss, i fixed it, appreciate your help

  • @frankiechan4939
    @frankiechan4939 7 місяців тому

    May I know how to fix the digit position is changing?

    • @ekin-yalgin
      @ekin-yalgin  4 місяці тому

      To fix the digit position changing in After Effects, ensure that the anchor points of your text layers are aligned correctly. Use the "Character" panel to adjust the baseline shift and kerning to keep the digits in a fixed position. Additionally, consider using a monospaced font to ensure each digit occupies the same amount of space.

  • @homonovusmaps
    @homonovusmaps 9 місяців тому

    Does anybody know how to make the clock stop at a certain time?

    • @ekin-yalgin
      @ekin-yalgin  2 місяці тому

      To make the clock stop at a certain time in After Effects, you can use keyframes to animate the timer and then add a hold keyframe at the point where you want the clock to stop. Alternatively, you can use an expression to control the timer. For example, you can use the time expression and add a conditional statement to stop the timer at a specific time.

  • @mirashraful946
    @mirashraful946 Рік тому

    if i need to count down what should i change please?

    • @riffbaama
      @riffbaama Рік тому

      do it normal, forward, and then on another comp put a reverse. (just an idea)

    • @cedricgovaerts3279
      @cedricgovaerts3279 Рік тому +2

      The way I dit it was by changing the clockstart to the beginning time I wanted, and change "clockTime = Math.max(clockStart + rate*(time - inPoint),0)" to "clockTime = Math.max(clockStart - rate*(time - inPoint),0)" , which is basically subtract 1 instead of add 1 to the current time.

    • @david.cervantes
      @david.cervantes 11 місяців тому

      Do you know how to make the timer advance faster?@@cedricgovaerts3279

    • @9rifqifaza950
      @9rifqifaza950 8 місяців тому

      @@cedricgovaerts3279goated

  • @lugal1369
    @lugal1369 Рік тому

    thank you