Activity › Forums › Adobe After Effects Expressions › clock second hand ticking
-
clock second hand ticking
Posted by Riccardo Sinti on October 23, 2009 at 8:23 pmI 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 compMohd Faizan replied 6 years, 8 months ago 8 Members · 9 Replies -
9 Replies
-
Xinlai Ni
October 23, 2009 at 8:54 pmSimplest 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 pmThe 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. -
Adam Mercado
October 10, 2011 at 2:12 amcheers 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 pmHi,
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 pmI 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 amI knew Dan would have an easy answer to this…which I found 6 years later!
-
Bas V breugel
August 7, 2015 at 2:31 pmNice! 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 pmNo 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)
Reply to this Discussion! Login or Sign Up