Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Rotation expression for stopwatch

  • Rotation expression for stopwatch

    Posted by Michele Busiello on January 26, 2011 at 2:43 pm

    hi guys!

    i have an expression question which is so basic that i’m almost ashamed asking it 🙂
    here it comes:
    how do i build a rotation expression for a stopwatch hand ? i know there are tons of web-tutorials explaining how to set up an expression for a clock hand. but as opposed to those tutorials i DON’T want the clock hand to rotate smoothly. since it ist a stopwatch and not a clock the hand should rotate in a “jagged” fasion. like so: https://www.youtube.com/watch?v=23wsGQx5wZE

    how do i achieve that ?
    thx in advance!

    Dave Irion replied 13 years, 7 months ago 3 Members · 6 Replies
  • 6 Replies
  • Kevin Camp

    January 26, 2011 at 3:56 pm

    i don’t now what kind of control you want to have for it, but this will ‘tick’ the second hand every second, with no interpolation between ‘ticks’

    linear(Math.floor(time)%60,0,60,0,360)

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Michele Busiello

    January 26, 2011 at 4:11 pm

    thx for your reply!
    your solution works good and is going to the right direction. this expression is restricted to one tick/second though. is there a way to control the amount of ticks/time ?

  • Kevin Camp

    January 26, 2011 at 4:18 pm

    if you just wanted to key frame the rotation value but limit the values to increments of 6 degrees, you could try something like this:

    Math.floor(value/6)*6

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Kevin Camp

    January 26, 2011 at 5:28 pm

    or maybe you just wanted to use time, but wanted to have a hand that moved in 100ths of a second…

    linear((Math.floor(time*100)/100)%1,0,1,0,360)

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Kevin Camp

    January 26, 2011 at 5:45 pm

    this might be a little more intuitive…

    set the tickUnit to be the duration of a single tick.. so if you needed to tick each second, the value would be 1; every 10th of a second would be 1/10.

    set the period to be the amount of time (in seconds) that it takes for a hand to do a full 360 degree sweep. so for the second hand the value would be 60 (60 seconds to do a 360); for a 10th of a second the period would be 1 (1 second to do a 360)…

    tickUnit = 1/100; // duration for a single tick (in seconds)
    period = 1; // duration for a full sweep of the hand (in seconds)

    linear((Math.floor(time/tickUnit)*tickUnit)%period,0,period,0,360)

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Dave Irion

    September 25, 2012 at 3:25 pm

    Thanks for the great expressions. But I have a specific problem that I could use help on.

    I used this expression

    linear(Math.floor(time)%60,0,60,0,360)

    and it works great. But Is there a way to have the expression take a certain amount of frames to complete the rotation with an ease?

    So instead of the movement of the rotation happening instantly it would happen say over 10frames?

    Thanks

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