UNPKG

react-siriwave

Version:
45 lines 1.93 kB
import React, { useEffect, useRef } from 'react'; import * as SiriWave from 'siriwave'; var ReactSiriwave = function (props) { var siriwaveRef = useRef(null); useEffect(function () { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; var siriwave = new SiriWave["default"]({ container: siriwaveRef.current, style: (_a = props.theme) !== null && _a !== void 0 ? _a : 'ios', width: (_b = props.width) !== null && _b !== void 0 ? _b : 640, height: (_c = props.height) !== null && _c !== void 0 ? _c : 200, speed: (_d = props.speed) !== null && _d !== void 0 ? _d : 0.2, amplitude: (_e = props.amplitude) !== null && _e !== void 0 ? _e : 1, frequency: (_f = props.frequency) !== null && _f !== void 0 ? _f : 6, color: (_g = props.color) !== null && _g !== void 0 ? _g : '#fff', cover: (_h = props.cover) !== null && _h !== void 0 ? _h : false, autostart: (_j = props.autostart) !== null && _j !== void 0 ? _j : true, pixelDepth: (_k = props.pixelDepth) !== null && _k !== void 0 ? _k : 0.02, lerpSpeed: (_l = props.lerpSpeed) !== null && _l !== void 0 ? _l : 0.01, curveDefinition: props.curveDefinition }); if (typeof props.onInit === 'function') props.onInit(siriwave); return function () { siriwave.dispose(); }; }, [ props.amplitude, props.autostart, props.color, props.cover, props.curveDefinition, props.frequency, props.height, props.lerpSpeed, props.pixelDepth, props.speed, props.theme, props.width, props, ]); return React.createElement("div", { ref: siriwaveRef }); }; export default ReactSiriwave; //# sourceMappingURL=App.js.map