I'm drawing a non-traditional ring-clock in canvas. The time is represented by a second ring, second hand, minute ring, and hour ring. I am using webkit/mozRequestAnimationFrame to draw at the appropriate time. I would like to modify the second ring to animate to the next second quickly (125ms - 250ms) and with Quadratic easing (instead of that dreaded snap).
Much like the Raphael JS Clock animates its second ring, except it uses different easing: http://raphaeljs.com/polar-clock.html
JS Fiddle Links (must view in Chrome, Firefox, or Webkit Nightly):
Fiddle: http://jsfiddle.net/thecrypticace/qmwJx/
Full screen Fiddle: http://jsfiddle.net/thecrypticace/qmwJx/embedded/result/
Any help would be very much appreciated!
This comes close but is still really jerky:
var startValue;
if (milliseconds < 500) {
if (!startValue) startValue = milliseconds;
if (milliseconds - startValue <= 125) {
animatedSeconds = seconds - 0.5 + Math.easeIn(milliseconds - startValue, startValue, 1000 - startValue, 125)/1000;
} else {
animatedSeconds = seconds;
}
drawRing(384, 384, 384, 20, animatedSeconds / 60, 3 / 2 * Math.PI, false);
} else {
drawRing(384, 384, 384, 20, seconds / 60, 3 / 2 * Math.PI, false);
startValue = 0;
}