function tick(timestamp) {
                    var currentIteration, totalIterations, done;

                    if (typeof start === 'undefined') {
                        start = timestamp;
                    }
                    elapsed = timestamp - start;

                    totalIterations = Math.round(duration / 1000 * 60);
                    currentIteration = Math.round(elapsed / 1000 * 60);
                    done = type(element[0], currentIteration, totalIterations, totalChars, originalNodeValues);

                    if (elapsed < duration && !done) {
                        window.requestAnimationFrame(tick);
                    } else {
                        $timeout(function() {
                            removeCaret(element);
                        }, removeCaretAfter);

                        start = undefined;  // reset

                        // if a callback was defined by the on-completion attribute, invoke it now
                        if (onCompletion !== null) {
                            onCompletion(scope);
                        }
                    }
                }
This is the animation function that gets looped in a requestAnimationFrame call.
@param timestamp