2a5bac2bb3
* major JSDoc write up * removed ESLint `no-bitwise` exception, it only applies to specific functions and not the entire code * the `SVGCubicMorph` component will remove un-necessary `Z` path commands when is the case for better out of the box animation * fixed a minor disambiguation with `filterEffects` and `drop-shadow` property and its `dropshadow` interpolation function * TypeScript strong: all files are modules, easy to implement in any third party app * updated `CubicBezier` and SVGPathCommander * code cleanup
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
import getStyleForProperty from '../process/getStyleForProperty';
|
|
import numbers from '../interpolation/numbers';
|
|
import { onStartOpacity } from './opacityPropertyBase';
|
|
|
|
// Component Functions
|
|
/**
|
|
* Returns the current property computed style.
|
|
* @param {string} tweenProp the property name
|
|
* @returns {string} computed style for property
|
|
*/
|
|
function getOpacity(tweenProp/* , value */) {
|
|
return getStyleForProperty(this.element, tweenProp);
|
|
}
|
|
|
|
/**
|
|
* Returns the property tween object.
|
|
* @param {string} _ the property name
|
|
* @param {string} value the property value
|
|
* @returns {number} the property tween object
|
|
*/
|
|
function prepareOpacity(/* tweenProp, */_, value) {
|
|
return parseFloat(value); // opacity always FLOAT
|
|
}
|
|
|
|
// All Component Functions
|
|
const opacityFunctions = {
|
|
prepareStart: getOpacity,
|
|
prepareProperty: prepareOpacity,
|
|
onStart: onStartOpacity,
|
|
};
|
|
|
|
// Full Component
|
|
const OpacityProperty = {
|
|
component: 'opacityProperty',
|
|
property: 'opacity',
|
|
defaultValue: 1,
|
|
Interpolate: { numbers },
|
|
functions: opacityFunctions,
|
|
};
|
|
|
|
export default OpacityProperty;
|