ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

clock second hand ticking

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
riccardo sinti
clock second hand ticking
on Oct 23, 2009 at 8:23:11 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


Return to posts index

Xinlai Ni
Re: clock second hand ticking
on Oct 23, 2009 at 8:54:50 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.


Return to posts index

Xinlai Ni
Re: clock second hand ticking
on Oct 23, 2009 at 8:58:06 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.


Return to posts index


Bas v Breugel
Re: clock second hand ticking
on Aug 7, 2015 at 2:31:47 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.


Return to posts index

Mohd Faizan
Re: clock second hand ticking
on Jan 21, 2018 at 5:34:36 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)



Return to posts index

Trevor Gilchrist
Re: clock second hand ticking
on May 5, 2013 at 2:59:35 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)


Return to posts index


Dan Ebberts
Re: clock second hand ticking
on May 6, 2013 at 5:57:37 pm

I would think something like this should work:

clock = thisComp.layer("clock");
value - [clock.transform.rotation*20/6,0]


Dan



Return to posts index

Dan Ebberts
Re: clock second hand ticking
on Oct 23, 2009 at 11:13:15 pm

Try this:

Math.floor(time)*6


Dan



Return to posts index

Adam Mercado
Re: clock second hand ticking
on Oct 10, 2011 at 2:12:10 am

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


Return to posts index


Paul Roper
Re: clock second hand ticking
on Jul 24, 2015 at 9:40:25 am

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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]