28
Vote

Second Hand Movement

The usual choices for moving the second hand are either by jumps each second or smoothly. Both are nice, but there are other options. Probably the nicest I've seen so far is setting the rotation to

{drss}+math.sin(math.rad({drss}*60))-3

which gives a pleasing “smooth-step” motion: rest on the second-tick for a moment, smoothly move to the next one, subtly speeding up to start and slowing down to stop. This function works by superimposing a 60-per-minute (1 Hz) sine curve “ripple” on top of the smooth seconds motion. The “pause” happens because part of the “ripple” is a backward motion that cancels out the forward smooth motion. There are some other possibilities too, though the differences might be very subtle. (The rest of this section gets a little involved; you can copy code directly if you like, but there's also an attempt to explain it so you can craft your own.) For example, something where the second hand remains on its tick for half a second, and then over the next half-second moves at constant speed (unlike above, where it eased into and out of its motion) to the next tick, you could use

{drs}+math.max(0, ({dss}/1000-0.5)*12)

Note the use of math.max(). We're taking {dss}/1000 (the fractional part of the second), subtracting one-half (so it's negative for the first half and goes up only to ½), multiplying by 12 (it has to move six degrees between ticks, but we're not using the first six) and then using math.max() to “clamp” the value so it doesn't go below zero, i.e. the first half-second doesn't do anything.

We can really go more general, and use any of the “easing” functions that Watchmaker provides. See http://watchmaker.haz.wiki/lua#tweening_functions for graphs of these. They're various ways you can move something from zero to one (or any two values) smoothly, but not necessarily evenly: maybe faster at the beginning, maybe slower, etc. Most of them are variations on the same shape, just sharper or gentler (I can't think of a case where I would use inOutCubic but not inOutQuad. Who would really notice the difference?) So you might like to use one of the Back functions, which “overshoots” slightly, e.g.

{drs}+inBack({dss}, 0, 6, 1000)

which will seem to pull back slightly before going to the next second. Or maybe move only in the second half of the second, as above, and this time overshoot the destination instead of pulling back before starting:

{drs}+outBack(math.max(0, {dss}-500), 0, 6, 500)

These easing functions are a little strange to use directly; you have to remember their parameters: 1) where are we now (input)? 2) what's the starting output? 3) what's the change from starting to ending output? 4) what's the ending input?

Published by Mark Shoulson on 27 August 2015WatchMaker Tips & Tricks Posted

This Website and It's Resources are Powered by:
  
WatchMaker Beautiful Watches for Android Wear

No smartwatch required!! Best clock wallpaper for Android!
  
WatchMaker Live WallPaper

Introducing the Perfect Companion App for WatchMaker...
  
GearsPro (OBD 2 & Car)