UNPKG

modo-mobile

Version:

A mobile UI toolkit, based on React

47 lines (39 loc) 1.85 kB
import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _createClass from 'babel-runtime/helpers/createClass'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import * as React from 'react'; var CarouselCircle = function (_React$PureComponent) { _inherits(CarouselCircle, _React$PureComponent); function CarouselCircle() { _classCallCheck(this, CarouselCircle); return _possibleConstructorReturn(this, (CarouselCircle.__proto__ || Object.getPrototypeOf(CarouselCircle)).apply(this, arguments)); } _createClass(CarouselCircle, [{ key: 'render', value: function render() { var _props = this.props, size = _props.size, index = _props.index, animateValues = _props.animateValues; var cx = index * size * 1.5 + size / 2; var opacityValues = animateValues.join(';'); var sizeValues = animateValues.map(function (val) { return val * size / 2; }).join(';'); return React.createElement( 'circle', { cx: cx, cy: size / 2, r: size / 2 }, React.createElement('animate', { attributeName: 'fill-opacity', calcMode: 'linear', repeatCount: 'indefinite', attributeType: 'XML', begin: '0s', dur: '1s', values: opacityValues }), React.createElement('animate', { attributeName: 'r', calcMode: 'linear', repeatCount: 'indefinite', attributeType: 'XML', begin: '0s', dur: '1s', values: sizeValues }) ); } }]); return CarouselCircle; }(React.PureComponent); export default CarouselCircle; CarouselCircle.defaultProps = { index: 0, size: 16, animateValues: [] };