UNPKG

@jdcfe/yep-react

Version:

一套移动端的React组件库

69 lines (67 loc) 2.31 kB
import * as React from 'react'; import uid from './uid'; var Wrap = function Wrap(_ref) { var uniquekey = _ref.uniquekey, width = _ref.width, height = _ref.height, style = _ref.style, className = _ref.className, children = _ref.children, primaryColor = _ref.primaryColor, primaryOpacity = _ref.primaryOpacity, secondaryColor = _ref.secondaryColor, secondaryOpacity = _ref.secondaryOpacity, speed = _ref.speed, animate = _ref.animate, preserveAspectRatio = _ref.preserveAspectRatio; var idClip = uniquekey ? "".concat(uniquekey, "-idClip") : uid(); var idGradient = uniquekey ? "".concat(uniquekey, "-idGradient") : uid(); return /*#__PURE__*/React.createElement("svg", { viewBox: "0 0 ".concat(width, " ").concat(height), version: "1.1", style: style, preserveAspectRatio: preserveAspectRatio, className: className }, /*#__PURE__*/React.createElement("rect", { style: { fill: "url(#".concat(idGradient, ")") }, clipPath: "url(#".concat(idClip, ")"), x: "0", y: "0", width: width, height: height }), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", { id: idClip }, children), /*#__PURE__*/React.createElement("linearGradient", { id: idGradient }, /*#__PURE__*/React.createElement("stop", { offset: "0%", stopColor: primaryColor, stopOpacity: primaryOpacity }, animate ? /*#__PURE__*/React.createElement("animate", { attributeName: "offset", values: "-2; 1", dur: "".concat(speed, "s"), repeatCount: "indefinite" }) : null), /*#__PURE__*/React.createElement("stop", { offset: "50%", stopColor: secondaryColor, stopOpacity: secondaryOpacity }, animate ? /*#__PURE__*/React.createElement("animate", { attributeName: "offset", values: "-1.5; 1.5", dur: "".concat(speed, "s"), repeatCount: "indefinite" }) : null), /*#__PURE__*/React.createElement("stop", { offset: "100%", stopColor: primaryColor, stopOpacity: primaryOpacity }, animate ? /*#__PURE__*/React.createElement("animate", { attributeName: "offset", values: "-1; 2", dur: "".concat(speed, "s"), repeatCount: "indefinite" }) : null)))); }; export default Wrap;