Animated clock using request animation frame