function checkAnimationShouldBeFinished(animation, queueName, defaultQueue) {
    validateTweens(animation);
    if (queueName === undefined || queueName === getValue(animation.queue, animation.options.queue, defaultQueue)) {
        if (!(animation._flags & 4 /* STARTED */)) {
            // tslint:disable-line:no-bitwise
            // Copied from tick.ts - ensure that the animation is completely
            // valid and run begin() before complete().
            var options = animation.options;
            // 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 = animation;
                if (options.begin) {
                    // Pass to an external fn with a try/catch block for optimisation
                    beginCall(animation);
                    // Only called once, even if reversed or repeated
                    options.begin = undefined;
                }
            }
            animation._flags |= 4 /* STARTED */; // tslint:disable-line:no-bitwise
        }
        // tslint:disable-next-line:forin
        for (var property in animation.tweens) {
            var tween = animation.tweens[property],
                sequence = tween.sequence,
                pattern = sequence.pattern;
            var currentValue = "",
                i = 0;
            if (pattern) {
                var endValues = sequence[sequence.length - 1];
                for (; i < pattern.length; i++) {
                    var endValue = endValues[i];
                    currentValue += endValue == null ? pattern[i] : endValue;
                }
            }
            setPropertyValue(animation.element, property, currentValue, tween.fn);
        }
        completeCall(animation);
    }
}
Check if an animation should be finished, and if so we set the tweens to
the final value for it, then call complete.