Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions clock second hand ticking

  • clock second hand ticking

  • riccardo sinti

    October 23, 2009 at 8:23 pm

    I have a clock face with a second hand that rotates 360degrees over one minute.
    I would like to have the hand “tick” not smoothly rotate.
    I suppose I could change the frame rate of my comp but how would I do this with an expression as in
    “rotate 1 degree every second for one minute”
    30 fps comp

  • Xinlai Ni

    October 23, 2009 at 8:54 pm

    Simplest thing is you can make it rotate from the beginning of N second to N+0.2 second (smoothly) so within every second, it first rotates very quickly, then take a rest for the remaining 0.8 sec, here is the rotation property’s expression for that (assuming you’ve already moved the anchor point of the hand to one of its end at the clock face center):

    wholeSecond = Math.floor(time);
    rotateDuration = 0.2;
    anglePerSecond = 6; // 360 / 60
    startAngle = wholeSecond * anglePerSecond;

    linear(time, wholeSecond, wholeSecond + rotateDuration, startAngle, startAngle + anglePerSecond)

    Xinlai Ni
    Software Engineer, Google Inc.

  • Xinlai Ni

    October 23, 2009 at 8:58 pm

    The above expression makes the second hand tick at the beginning of the second, I think in reality, you want it to tick at the end of every second, just replace the linear expression with this one
    linear(time, wholeSecond + 0.8, wholeSecond + 1, startAngle, startAngle + anglePerSecond)

    Xinlai Ni
    Software Engineer, Google Inc.

  • Dan Ebberts

    October 23, 2009 at 11:13 pm

    Try this:

    Math.floor(time)*6

    Dan

  • Adam Mercado

    October 10, 2011 at 2:12 am

    cheers Dan, this worked perfectly out of the box. Thanks to Google for finding this thread for me. Problem solved in seconds flat 🙂

  • Trevor Gilchrist

    May 5, 2013 at 2:59 pm

    Hi,

    I found this expression of yours (with its amendment) and really like the movement it produces. Thanks.
    Is there any way (as a non-coder), I could use the output of this to move a null a specified number of pixels on the x axis “in sync” with the ticking second hand.

    So, in layman’s terms: every tick os the clock, moves the null 20px to the left, but with the same timing that this script produces (ie, at the “end of the second”? I’m basically trying to make it look like the second hand is locked to — and “driving” — a flat panel across the screen)

    If you’re still around I’d love to know how to do this.

    Many thanks.

    (And to Dan Ebberts, your far simpler expression is, as always, so elegant, but on anything uniform, like a cog, produces no sense of movement. The cog turns, but one doesn’t get a sense of it actually turning… If that makes sense)

  • Dan Ebberts

    May 6, 2013 at 5:57 pm

    I would think something like this should work:

    clock = thisComp.layer(“clock”);
    value – [clock.transform.rotation*20/6,0]

    Dan

  • Paul Roper

    July 24, 2015 at 9:40 am

    I knew Dan would have an easy answer to this…which I found 6 years later!

  • Bas v Breugel

    August 7, 2015 at 2:31 pm

    Nice! Is there a way to give it a little ‘wiggle’at the end of echt stroke? So the second hand feels a little bit more bouncy wenn it hits a new second.

  • Mohd Faizan

    January 21, 2018 at 5:34 pm

    No need to add wiggle, just replace linear to ease

    wholeSecond = Math.floor(time);
    rotateDuration = 0.2;
    anglePerSecond = 6; // 360 / 60
    startAngle = wholeSecond * anglePerSecond;

    ease(time, wholeSecond, wholeSecond + rotateDuration, startAngle, startAngle + anglePerSecond)

Viewing 1 - 10 of 10 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy