{"ast":null,"code":"import Animated from \"react-native-web/dist/exports/Animated\";\nvar add = Animated.add,\n multiply = Animated.multiply;\nexport default function conditional(condition, main, fallback) {\n return add(multiply(condition, main), multiply(condition.interpolate({\n inputRange: [0, 1],\n outputRange: [1, 0]\n }), fallback));\n}","map":{"version":3,"sources":["conditional.tsx"],"names":["add","multiply","Animated","conditional","condition","main","fallback","interpolate","inputRange","outputRange"],"mappings":";AAEA,IAAQA,GAAG,GAAeE,QAAQ,CAA1BF,GAAG;EAAEC,QAAAA,GAAaC,QAAQ,CAArBD,QAAAA;AASb,eAAe,SAASE,WAAW,CACjCC,SAAyC,EACzCC,IAAoC,EACpCC,QAAwC,EACxC;EAOA,OAAON,GAAG,CACRC,QAAQ,CAACG,SAAS,EAAEC,IAAI,CAAC,EACzBJ,QAAQ,CACNG,SAAS,CAACG,WAAW,CAAC;IACpBC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAClBC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC;EACpB,CAAC,CAAC,EACFH,QAAQ,CACT,CACF;AACH","sourceRoot":"../../src","sourcesContent":["import { Animated } from 'react-native';\nconst {\n add,\n multiply\n} = Animated;\n\n/**\n * Use an Animated Node based on a condition. Similar to Reanimated's `cond`.\n *\n * @param condition Animated Node representing the condition, must be 0 or 1, 1 means `true`, 0 means `false`\n * @param main Animated Node to use if the condition is `true`\n * @param fallback Animated Node to use if the condition is `false`\n */\nexport default function conditional(condition, main, fallback) {\n // To implement this behavior, we multiply the main node with the condition.\n // So if condition is 0, result will be 0, and if condition is 1, result will be main node.\n // Then we multiple reverse of the condition (0 if condition is 1) with the fallback.\n // So if condition is 0, result will be fallback node, and if condition is 1, result will be 0,\n // This way, one of them will always be 0, and other one will be the value we need.\n // In the end we add them both together, 0 + value we need = value we need\n return add(multiply(condition, main), multiply(condition.interpolate({\n inputRange: [0, 1],\n outputRange: [1, 0]\n }), fallback));\n}\n//# sourceMappingURL=conditional.js.map"]},"metadata":{},"sourceType":"module"}