UNPKG

@r3l/app

Version:
2 lines 7.66 kB
(window.__LOADABLE_LOADED_CHUNKS__=window.__LOADABLE_LOADED_CHUNKS__||[]).push([[25],{"./public/img/icons/upvoteActive.png":function(e,t,n){e.exports=n.p+"public/img/upvoteActive.png"},"./src/modules/animation/upvoteAnimation.component.js":function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return U}));var r=n("../../node_modules/@babel/runtime/helpers/toConsumableArray.js"),o=n.n(r),i=n("../../node_modules/@babel/runtime/helpers/slicedToArray.js"),a=n.n(i),s=n("../../node_modules/react/index.js"),u=n.n(s),c=n("../../node_modules/react-redux/es/index.js"),p=n("./src/styles/index.js"),l=n("../../node_modules/@babel/runtime/helpers/classCallCheck.js"),f=n.n(l),d=n("../../node_modules/@babel/runtime/helpers/createClass.js"),y=n.n(d),m=n("../../node_modules/@babel/runtime/helpers/inherits.js"),h=n.n(m),b=n("../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"),g=n.n(b),v=n("../../node_modules/@babel/runtime/helpers/getPrototypeOf.js"),O=n.n(v),j=n("../../node_modules/@babel/runtime/helpers/defineProperty.js"),R=n.n(j),x=n("../../node_modules/react-native-web/dist/exports/Animated/index.js"),_=n("../../node_modules/react-native-web/dist/exports/Image/index.js"),w=n("../../node_modules/prop-types/index.js"),E=n.n(w),P=n("./src/styles/layout.js");function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function D(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?A(Object(n),!0).forEach((function(t){R()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function k(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=O()(e);if(t){var o=O()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return g()(this,n)}}var z={upvote:{size:28,icon:n("./public/img/icons/upvoteActive.png")},bet:{size:18,icon:n("./public/img/relevantcoin.png")}},K=function(e){h()(n,e);var t=k(n);function n(e,r){var o;return f()(this,n),(o=t.call(this,e,r)).state={position:new x.a.Value(0)},o}return y()(n,[{key:"UNSAFE_componentWillMount",value:function(){var e=this.props.parent,t=e.x,n=e.y,r=50*Math.random();this.y=this.state.position.interpolate({inputRange:[0,1],outputRange:[n,n-300]}),this.x=this.state.position.interpolate({inputRange:[0,.5*Math.random(),1],outputRange:[t,t+r/2,t+r]}),this.opacity=this.state.position.interpolate({inputRange:[.7,1],outputRange:[1,0],extrapolate:"clamp"}),this.rotateAnimation=this.state.position.interpolate({inputRange:[0,1/4,1/3,.5,1],outputRange:["0deg","-2deg","0deg","2deg","0deg"]}),this.scale=this.state.position.interpolate({inputRange:[0,.2,.3,1],outputRange:[0,1.2,1,1.5],extrapolate:"clamp"})}},{key:"componentDidMount",value:function(){var e=this,t=this.props.specialKey,n=Math.random();x.a.timing(this.state.position,{toValue:1,delay:t*(75+50*n),duration:1e3,useNativeDriver:!0}).start((function(){return e.props.destroy(t)}))}},{key:"render",value:function(){var e=this.props,t=e.specialKey,n=e.horizontal,r=e.parent,o=e.type,i=z[o],a=i.icon,s=i.size,c=u.a.createElement(_.a,{resizeMode:"contain",style:{width:s,height:s},source:a});return u.a.createElement(x.a.View,{key:t,style:[D({},P.animatedElement),{left:n?0:r.w/2,transform:[{translateX:this.x},{translateY:this.y},{scale:this.scale},{rotate:this.rotateAnimation}],opacity:this.opacity}]},c)}}]),n}(s.Component);R()(K,"propTypes",{horizontal:E.a.bool,parent:E.a.object,specialKey:E.a.number,destroy:E.a.func,type:E.a.string});var M=K,C=n("./src/modules/styled/index.ts");function S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function B(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S(Object(n),!0).forEach((function(t){R()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function L(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=O()(e);if(t){var o=O()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return g()(this,n)}}var V=function(e){h()(n,e);var t=L(n);function n(e,r){var o;f()(this,n),(o=t.call(this,e,r)).state={position:new x.a.Value(0)};var i=o.props.parent,a=i.x,s=i.y,u=20*(Math.random()-.5);return o.y=o.state.position.interpolate({inputRange:[0,1],outputRange:[s+10,s-100]}),o.x=o.state.position.interpolate({inputRange:[0,.05,.5,1],outputRange:[a-15,a,a+u/2,a+u]}),o.opacity=o.state.position.interpolate({inputRange:[.7,1],outputRange:[1,0],extrapolate:"clamp"}),o.rotateAnimation=o.state.position.interpolate({inputRange:[0,1/4,1/3,.5,1],outputRange:["0deg","-2deg","0deg","2deg","0deg"]}),o.scale=o.state.position.interpolate({inputRange:[0,.05,.1,.9,.95,1],outputRange:[0,1.4,1,1,1.2,0]}),o}return y()(n,[{key:"componentDidMount",value:function(){var e=this,t=this.props.amount,n=this.props.specialKey,r=Math.random();x.a.timing(this.state.position,{toValue:1,delay:30*r+100*n*10/t,duration:2e3,useNativeDriver:!0}).start((function(){return e.props.destroy(null,n)}))}},{key:"render",value:function(){var e=this.props,t=e.amount,n=e.parent,r=e.horizontal,o=n.w,i=this.props.specialKey,a=u.a.createElement(C.I,{sx:{color:"green"}},"+",t);return u.a.createElement(x.a.View,{key:i,style:[B({},P.animatedElement),{left:r?20:2*o/3,transform:[{translateX:this.x},{translateY:this.y},{scale:this.scale}],opacity:this.opacity}]},a)}}]),n}(s.Component);R()(V,"propTypes",{parent:E.a.object,specialKey:E.a.number,amount:E.a.number,destroy:E.a.func,horizontal:E.a.bool});var N=V,T=["upvote","bet"],I=Object(C.M)(C.K)({position:1==p.d?"absolute":"fixed",zIndex:1e4,left:0,top:0,right:0,bottom:0});function U(){var e=Object(c.d)((function(e){return e.animation.currentType})),t=Object(c.d)((function(t){return T.includes(e)?t.animation[e]:{}})),n=t.index,r=t.parent,i=t.horizontal,p=t.amount,l=Object(s.useState)([]),f=a()(l,2),d=f[0],y=f[1],m=Object(s.useState)([]),h=a()(m,2),b=h[0],g=h[1];if(Object(s.useEffect)((function(){return r&&(y(o()(Array(10).keys())),p&&g(o()(Array(1).keys()))),function(){y([]),g([])}}),[n,r,p]),!T.includes(e))return null;function v(e,t){"number"==typeof e&&y((function(t){return[].concat(o()(t.slice(0,e)),o()(t.slice(e+1)))})),"number"==typeof t&&g((function(e){return[].concat(o()(e.slice(0,t)),o()(e.slice(t+1)))}))}return u.a.createElement(I,{pointerEvents:"none"},d.map((function(t){return u.a.createElement(M,{type:e,horizontal:i,destroy:v,parent:r,key:t,specialKey:t})})),b.map((function(e){return u.a.createElement(N,{destroy:v,parent:r,amount:p,key:e,specialKey:e,horizontal:i})})))}}}]); //# sourceMappingURL=animation-upvoteAnimation-component.bundle.07ed4322e2ad7be67bee.js.map