* Expand a VelocityProperty argument into a valid sparse Tween array. This * pre-allocates the array as it is then the correct size and slightly * faster to access.
(animation, properties)
| 1716 | * faster to access. |
| 1717 | */ |
| 1718 | function expandProperties(animation, properties) { |
| 1719 | var tweens = animation.tweens = Object.create(null), |
| 1720 | elements = animation.elements, |
| 1721 | element = animation.element, |
| 1722 | elementArrayIndex = elements.indexOf(element), |
| 1723 | data = Data(element), |
| 1724 | queue = getValue(animation.queue, animation.options.queue), |
| 1725 | duration = getValue(animation.options.duration, defaults$1.duration); |
| 1726 | for (var property in properties) { |
| 1727 | if (properties.hasOwnProperty(property)) { |
| 1728 | var propertyName = camelCase(property), |
| 1729 | fn = getNormalization(element, propertyName); |
| 1730 | var valueData = properties[property]; |
| 1731 | if (!fn && propertyName !== "tween") { |
| 1732 | if (Velocity$$1.debug) { |
| 1733 | console.log("Skipping \"" + property + "\" due to a lack of browser support."); |
| 1734 | } |
| 1735 | continue; |
| 1736 | } |
| 1737 | if (valueData == null) { |
| 1738 | if (Velocity$$1.debug) { |
| 1739 | console.log("Skipping \"" + property + "\" due to no value supplied."); |
| 1740 | } |
| 1741 | continue; |
| 1742 | } |
| 1743 | var tween = tweens[propertyName] = {}; |
| 1744 | var endValue = void 0, |
| 1745 | startValue = void 0; |
| 1746 | tween.fn = fn; |
| 1747 | if (isFunction(valueData)) { |
| 1748 | // If we have a function as the main argument then resolve |
| 1749 | // it first, in case it returns an array that needs to be |
| 1750 | // split. |
| 1751 | valueData = valueData.call(element, elementArrayIndex, elements.length, elements); |
| 1752 | } |
| 1753 | if (Array.isArray(valueData)) { |
| 1754 | // valueData is an array in the form of |
| 1755 | // [ endValue, [, easing] [, startValue] ] |
| 1756 | var arr1 = valueData[1], |
| 1757 | arr2 = valueData[2]; |
| 1758 | endValue = valueData[0]; |
| 1759 | if (isString(arr1) && (/^[\d-]/.test(arr1) || rxHex.test(arr1)) || isFunction(arr1) || isNumber(arr1)) { |
| 1760 | startValue = arr1; |
| 1761 | } else if (isString(arr1) && Easings[arr1] || Array.isArray(arr1)) { |
| 1762 | tween.easing = validateEasing(arr1, duration); |
| 1763 | startValue = arr2; |
| 1764 | } else { |
| 1765 | startValue = arr1 || arr2; |
| 1766 | } |
| 1767 | } else { |
| 1768 | endValue = valueData; |
| 1769 | } |
| 1770 | tween.end = commands[typeof endValue === "undefined" ? "undefined" : _typeof(endValue)](endValue, element, elements, elementArrayIndex, propertyName, tween); |
| 1771 | if (startValue != null || queue === false || data.queueList[queue] === undefined) { |
| 1772 | tween.start = commands[typeof startValue === "undefined" ? "undefined" : _typeof(startValue)](startValue, element, elements, elementArrayIndex, propertyName, tween); |
| 1773 | explodeTween(propertyName, tween, duration); |
| 1774 | } |
| 1775 | } |
no test coverage detected
searching dependent graphs…