function tick(timestamp) {
    if (ticking) {
        // Should never happen - but if we've swapped back from hidden to
        // visibile then we want to make sure
        return;
    }
    ticking = true;
    /* An empty timestamp argument indicates that this is the first tick occurence since ticking was turned on.
     We leverage this metadata to fully ignore the first tick pass since RAF's initial pass is fired whenever
     the browser's next tick sync time occurs, which results in the first elements subjected to Velocity
     calls being animated out of sync with any elements animated immediately thereafter. In short, we ignore
     the first RAF tick pass so that elements being immediately consecutively animated -- instead of simultaneously animated
     by the same Velocity call -- are properly batched into the same initial RAF tick and consequently remain in sync thereafter. */
    if (timestamp !== false) {
        var timeCurrent = performance.now(),
            deltaTime = lastTick ? timeCurrent - lastTick : FRAME_TIME,
            defaultSpeed = defaults$1.speed,
            defaultEasing = defaults$1.easing,
            defaultDuration = defaults$1.duration;
        var activeCall = void 0,
            nextCall = void 0;
        if (deltaTime >= defaults$1.minFrameTime || !lastTick) {
            lastTick = timeCurrent;
            /********************
             Call Iteration
             ********************/
            // Expand any tweens that might need it.
            while (State.firstNew) {
                validateTweens(State.firstNew);
            }
            // Iterate through each active call.
            for (activeCall = State.first; activeCall && activeCall !== State.firstNew; activeCall = activeCall._next) {
                var element = activeCall.element,
                    data = Data(element);
                // Check to see if this element has been deleted midway
                // through the animation. If it's gone then end this
                // animation.
                if (!element.parentNode || !data) {
                    // TODO: Remove safely - decrease count, delete data, remove from arrays
                    freeAnimationCall(activeCall);
                    continue;
                }
                // Don't bother getting until we can use these.
                var options = activeCall.options,
                    flags = activeCall._flags;
                var timeStart = activeCall.timeStart;
                // If this is the first time that this call has been
                // processed by tick() then we assign timeStart now so that
                // it's value is as close to the real animation start time
                // as possible.
                if (!timeStart) {
                    var queue = activeCall.queue != null ? activeCall.queue : options.queue;
                    timeStart = timeCurrent - deltaTime;
                    if (queue !== false) {
                        timeStart = Math.max(timeStart, data.lastFinishList[queue] || 0);
                    }
                    activeCall.timeStart = timeStart;
                }
                // If this animation is paused then skip processing unless
                // it has been set to resume.
                if (flags & 16 /* PAUSED */) {
                        // tslint:disable-line:no-bitwise
                        // Update the time start to accomodate the paused
                        // completion amount.
                        activeCall.timeStart += deltaTime;
                        continue;
                    }
                // Check if this animation is ready - if it's synced then it
                // needs to wait for all other animations in the sync
                if (!(flags & 2 /* READY */)) {
                    // tslint:disable-line:no-bitwise
                    activeCall._flags |= 2 /* READY */; // tslint:disable-line:no-bitwise
                    options._ready++;
                }
            }
            // Need to split the loop, as ready sync animations must all get
            // the same start time.
            for (activeCall = State.first; activeCall && activeCall !== State.firstNew; activeCall = nextCall) {
                var _flags = activeCall._flags;
                nextCall = activeCall._next;
                if (!(_flags & 2 /* READY */) || _flags & 16 /* PAUSED */) {
                    // tslint:disable-line:no-bitwise
                    continue;
                }
                var _options = activeCall.options;
                if (_flags & 32 /* SYNC */ && _options._ready < _options._total) {
                    // tslint:disable-line:no-bitwise
                    activeCall.timeStart += deltaTime;
                    continue;
                }
                var speed = activeCall.speed != null ? activeCall.speed : _options.speed != null ? _options.speed : defaultSpeed;
                var _timeStart = activeCall.timeStart;
                // Don't bother getting until we can use these.
                if (!(_flags & 4 /* STARTED */)) {
                    // tslint:disable-line:no-bitwise
                    var delay = activeCall.delay != null ? activeCall.delay : _options.delay;
                    // Make sure anything we've delayed doesn't start
                    // animating yet, there might still be an active delay
                    // after something has been un-paused
                    if (delay) {
                        if (_timeStart + delay / speed > timeCurrent) {
                            continue;
                        }
                        activeCall.timeStart = _timeStart += delay / (delay > 0 ? speed : 1);
                    }
                    activeCall._flags |= 4 /* STARTED */; // tslint:disable-line:no-bitwise
                    // The begin callback is fired once per call, not once
                    // per element, and is passed the full raw DOM element
                    // set as both its context and its first argument.
                    if (_options._started++ === 0) {
                        _options._first = activeCall;
                        if (_options.begin) {
                            // Pass to an external fn with a try/catch block for optimisation
                            beginCall(activeCall);
                            // Only called once, even if reversed or repeated
                            _options.begin = undefined;
                        }
                    }
                }
                if (speed !== 1) {
                    // On the first frame we may have a shorter delta
                    // const delta = Math.min(deltaTime, timeCurrent - timeStart);
                    activeCall.timeStart = _timeStart += Math.min(deltaTime, timeCurrent - _timeStart) * (1 - speed);
                }
                var activeEasing = activeCall.easing != null ? activeCall.easing : _options.easing != null ? _options.easing : defaultEasing,
                    millisecondsEllapsed = activeCall.ellapsedTime = timeCurrent - _timeStart,
                    duration = activeCall.duration != null ? activeCall.duration : _options.duration != null ? _options.duration : defaultDuration,
                    percentComplete = activeCall.percentComplete = Velocity$$1.mock ? 1 : Math.min(millisecondsEllapsed / duration, 1),
                    tweens = activeCall.tweens,
                    reverse = _flags & 64 /* REVERSE */; // tslint:disable-line:no-bitwise
                if (activeCall.progress || _options._first === activeCall && _options.progress) {
                    progressed.add(activeCall);
                }
                if (percentComplete === 1) {
                    completed.add(activeCall);
                }
                // tslint:disable-next-line:forin
                for (var property in tweens) {
                    // For every element, iterate through each property.
                    var tween = tweens[property],
                        sequence = tween.sequence,
                        pattern = sequence.pattern;
                    var currentValue = "",
                        i = 0;
                    if (pattern) {
                        var easingComplete = (tween.easing || activeEasing)(percentComplete, 0, 1, property);
                        var best = 0;
                        for (var j = 0; j < sequence.length - 1; j++) {
                            if (sequence[j].percent < easingComplete) {
                                best = j;
                            }
                        }
                        var tweenFrom = sequence[best],
                            tweenTo = sequence[best + 1] || tweenFrom,
                            rawPercent = (percentComplete - tweenFrom.percent) / (tweenTo.percent - tweenFrom.percent),
                            tweenPercent = reverse ? 1 - rawPercent : rawPercent,
                            easing = tweenTo.easing || activeEasing || linearEasing;
                        for (; i < pattern.length; i++) {
                            var startValue = tweenFrom[i];
                            if (startValue == null) {
                                currentValue += pattern[i];
                            } else {
                                var endValue = tweenTo[i];
                                if (startValue === endValue) {
                                    currentValue += startValue;
                                } else {
                                    // All easings must deal with numbers except for our internal ones.
                                    var result = easing(tweenPercent, startValue, endValue, property);
                                    currentValue += pattern[i] !== true ? result : Math.round(result);
                                }
                            }
                        }
                        if (property !== "tween") {
                            if (percentComplete === 1) {
                                currentValue = removeNestedCalc(currentValue);
                            }
                            // TODO: To solve an IE<=8 positioning bug, the unit type must be dropped when setting a property value of 0 - add normalisations to legacy
                            setPropertyValue(activeCall.element, property, currentValue, tween.fn);
                        } else {
                            // Skip the fake 'tween' property as that is only
                            // passed into the progress callback.
                            activeCall.tween = currentValue;
                        }
                    } else {
                        console.warn("VelocityJS: Missing pattern:", property, JSON.stringify(tween[property]));
                        delete tweens[property];
                    }
                }
            }
            if (progressed.size || completed.size) {
                if (!document.hidden) {
                    asyncCallbacks();
                } else if (worker) {
                    worker.postMessage("");
                } else {
                    setTimeout(asyncCallbacks, 1);
                }
            }
        }
    }
    if (State.first) {
        State.isTicking = true;
        if (!document.hidden) {
            rAFShim(tick);
        } else if (!worker) {
            rAFProxy(tick);
        } else if (timestamp === false) {
            // Make sure we turn on the messages.
            worker.postMessage(true);
        }
    } else {
        State.isTicking = false;
        lastTick = 0;
        if (document.hidden && worker) {
            // Make sure we turn off the messages.
            worker.postMessage(false);
        }
    }
    ticking = false;
}
Called on every tick, preferably through rAF. This is reponsible for
initialising any new animations, then starting any that need starting.
Finally it will expand any tweens and set the properties relating to
them. If there are any callbacks relating to the animations then they
will attempt to call at the end (with the exception of "begin").