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
37 lines
943 B
JavaScript
37 lines
943 B
JavaScript
import KEC from '../objects/kute';
|
|
import numbers from '../interpolation/numbers';
|
|
|
|
/* opacityProperty = {
|
|
property: 'opacity',
|
|
defaultValue: 1,
|
|
interpolators: {numbers},
|
|
functions = { prepareStart, prepareProperty, onStart }
|
|
} */
|
|
|
|
// Component Functions
|
|
/**
|
|
* Sets the property update function.
|
|
* @param {string} tweenProp the property name
|
|
*/
|
|
export function onStartOpacity(tweenProp/* , value */) {
|
|
// opacity could be 0 sometimes, we need to check regardless
|
|
if (tweenProp in this.valuesEnd && !KEC[tweenProp]) {
|
|
KEC[tweenProp] = (elem, a, b, v) => {
|
|
/* eslint-disable */
|
|
elem.style[tweenProp] = ((numbers(a, b, v) * 1000) >> 0) / 1000;
|
|
/* eslint-enable */
|
|
};
|
|
}
|
|
}
|
|
|
|
// Base Component
|
|
const OpacityPropertyBase = {
|
|
component: 'baseOpacity',
|
|
property: 'opacity',
|
|
// defaultValue: 1,
|
|
Interpolate: { numbers },
|
|
functions: { onStart: onStartOpacity },
|
|
};
|
|
|
|
export default OpacityPropertyBase;
|