UNPKG

crn-cli

Version:

The Ctrip React Native CLI Tools

1 lines 2.72 kB
__d(function(g,r,i,a,m,e,d){'use strict';var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),b=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),p=r(d[8]),f=p.Animated,h=p.PanResponder,x=p.StyleSheet,_=p.View,y=Math.PI/2/3,v=160,R=c(Array(5)).map(function(t,n){return 0===n?{x:0,y:0}:{x:-Math.cos(y*(n-1))*v,y:-Math.sin(y*(n-1))*v}}),M=(function(c){function p(t){var o;n(this,p),(o=s(this,b(p).call(this,t))).state={},o.state.bobbles=R.map(function(t,n){return new f.ValueXY}),o.state.selectedBobble=null;var l=function(){o.state.bobbles.forEach(function(t,n){f.spring(t,{toValue:{x:0,y:0}}).start()})};return o.state.bobbleResponder=h.create({onStartShouldSetPanResponder:function(){return!0},onPanResponderGrant:function(){R.forEach(function(t,n){f.spring(o.state.bobbles[n],{toValue:t,friction:3}).start()})},onPanResponderMove:f.event([null,{dx:o.state.bobbles[0].x,dy:o.state.bobbles[0].y}],{listener:function(t,n){var s=B(n);if(o.state.selectedBobble!==s){if(null!==o.state.selectedBobble){var b=R[o.state.selectedBobble];f.spring(o.state.bobbles[o.state.selectedBobble],{toValue:b}).start()}null!==s&&0!==s&&f.spring(o.state.bobbles[s],{toValue:o.state.bobbles[0]}).start(),o.state.selectedBobble=s}}}),onPanResponderRelease:l,onPanResponderTerminate:l}),o}return l(p,c),o(p,[{key:"render",value:function(){var n=this;return u.createElement(_,{style:P.bobbleContainer},this.state.bobbles.map(function(o,s){var b,l=n.state.bobbles.length-s-1,c=l>0?{}:n.state.bobbleResponder.panHandlers;return u.createElement(f.Image,t({},c,{key:s,source:{uri:C[l]},style:[P.circle,{backgroundColor:(b=[0,1,2].map(function(){return Math.floor(150*Math.random()+100)}),'rgb('+b.join(',')+')'),transform:n.state.bobbles[l].getTranslateTransform()}]}))}))}}]),p})(u.Component),P=x.create({circle:{position:'absolute',height:60,width:60,borderRadius:30,borderWidth:.5},bobbleContainer:{top:-68,paddingRight:66,flexDirection:'row',flex:1,justifyContent:'flex-end',backgroundColor:'transparent'}});function B(t){var n=t.dx,o=t.dy,s=1/0,b=null,l=Math.sqrt(n*n+o*o);return Math.abs(v-l)<80&&R.forEach(function(t,l){var c=t.x-n,u=t.y-o,p=c*c+u*u;p<s&&(s=p,b=l)}),b}var C=['https://scontent-sea1-1.xx.fbcdn.net/hphotos-xpf1/t39.1997-6/10173489_272703316237267_1025826781_n.png','https://scontent-sea1-1.xx.fbcdn.net/hphotos-xaf1/l/t39.1997-6/p240x240/851578_631487400212668_2087073502_n.png','https://scontent-sea1-1.xx.fbcdn.net/hphotos-xaf1/t39.1997-6/p240x240/851583_654446917903722_178118452_n.png','https://scontent-sea1-1.xx.fbcdn.net/hphotos-xaf1/t39.1997-6/p240x240/851565_641023175913294_875343096_n.png','https://scontent-sea1-1.xx.fbcdn.net/hphotos-xaf1/t39.1997-6/851562_575284782557566_1188781517_n.png'];m.exports=M},666756,[14,3,4,5,8,9,30,11,15]);