Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Jim Digiovanni on May 5, 2015 at 6:33 pm

    We have all seen the old clock rotation expression where you create a rotation for the second hand and then tie the minute hand to the rotation with an expression so that it moves at 1/60th the speed to simulate minutes and seconds right?

    I am trying to create something similar but with a ‘ticking’ clock like a timex watch on the second hand so that it ticks along. tick, tick, tick, tick instead of the smooth rotation. I have worked that out using this expression tied to rotation:

    var tick = time*6;
    Math.floor(tick)

    But what I want to happen is now to have the minute hand ( separate layer ) tick over 6 degrees every minute. In other words, it holds for 59 seconds and then jumps 6 degrees in 1 second.

    I can’t figure that part out. Any ideas?

    Thanks

    Jim DiGiovanni
    MotionGraphicsAcademy.com

    var tick = time*6;
    Math.floor(tick)

    Jason Jantzen replied 11 years ago 3 Members · 4 Replies
  • 4 Replies
  • Toma Ever

    May 6, 2015 at 2:13 am

    Math.floor(time/60)*6 ?

  • Jason Jantzen

    May 6, 2015 at 5:33 pm

    I’m curious what you figure out. On the other hand, why do you want it to behave like that? No analogue clock works like that.

    I have this cool ticking script that overshoots the second hand like a real ticking clock would.

    ttf=timeToFrames(t = time + thisComp.displayStartTime, fps = 1.0 / thisComp.frameDuration, isDuration = false);
    compFrameRate=15;
    angle=Math.floor(ttf/compFrameRate)*6;
    if (ttf % compFrameRate == 0) {
    angle+=.5;
    } else if (ttf % compFrameRate ==1) {
    angle-=.5;
    }

    Jason Jantzen
    vimeo.com/jasonj

  • Jim Digiovanni

    May 6, 2015 at 7:09 pm

    Jason:

    That is really nice movement! Very realistic! I have never played with the timeToFrames expression before. I am not sure if I understand everything that is happening in that script.

    I am going to repaste your script below, with my comments and maybe you can tell me if I understand what you have done here.

    I am going to just go ahead and say thanks in advance if you read through my comments and my muddled understanding of your elegant script.

    Thanks

    Jim

    var ttf = timeToFrames (t = time + thisComp.displayStartTime, fps = 1.0 / thisComp.frameDuration, isDuration = false);

    /* I get that the time to frames is converting each frame to 1 second. I don't understand this part of it / thisComp.frameDuration, isDuration = false); */

    compFrameRate=15; /* Is this a variable? I always add the var in front of my variables to help me recognize them */

    angle=Math.floor(ttf/compFrameRate)*6; /* OK, here with the Math.floor function you are saying 'rotate this object a minimum of 1 frame per second divided by 15fps multiplied by 6 ( to give us the 6 degrees of rotation per second. Is that correct? */

    if (ttf % compFrameRate == 0) {
    angle+=.5;
    } else if (ttf % compFrameRate ==1) {
    angle-=.5;
    }

    /* This section above, the if / else section, I see that is how you are getting the angle +.5 overshoot, I just don't understand how this works. */

  • Jason Jantzen

    May 6, 2015 at 7:32 pm

    Hey Jim, sorry, I didn’t write that. I just saved it from this thread here:

    https://forums.creativecow.net/thread/227/25456#26611

    Jason Jantzen
    vimeo.com/jasonj

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