How to use the react-native-redash.bInterpolate function in react-native-redash

To help you get started, we’ve selected a few react-native-redash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wcandillon / can-it-be-done-in-react-native / the-5-min / src / Accordion / Chevron.tsx View on Github external
export default ({ transition }: ChevronProps) => {
  const rotateZ = bInterpolate(transition, Math.PI, 0);
  const backgroundColor = bInterpolateColor(
    transition,
    { r: 82, g: 82, b: 81 },
    { r: 228, g: 86, b: 69 }
  );
  return (
    <Animated.View
      style={[styles.container, { transform: [{ rotateZ }], backgroundColor }]}
    >
      <Icon name="chevron-down" color="white" size={24} />
    </Animated.View>
  );
};
github wcandillon / can-it-be-done-in-react-native / season2 / monzo-card-selection / components / CardSelection2.tsx View on Github external
onChange(nextIndex, [
        cond(and(not(clockRunning(clock)), neq(nextIndex, selectedCard)), [
          set(selectedCard, nextIndex),
          call([selectedCard], selectCardState)
        ])
      ]),
      cond(eq(selectedCard, INITIAL_INDEX), [
        set(spring, timing(clock)),
        set(cardRotates[0], bInterpolate(spring, 0, -15)),
        set(cardRotates[1], 0),
        set(cardRotates[2], bInterpolate(spring, 0, 15))
      ]),
      cond(and(neq(selectedCard, INITIAL_INDEX), not(firstSelectionIsDone)), [
        set(spring, timing(clock)),
        set(cardRotates[0], bInterpolate(spring, 0, -7.5)),
        set(cardRotates[1], bInterpolate(spring, 0, 7.5)),
        set(cardRotates[2], bInterpolate(spring, 15, 0)),
        set(translationX, bInterpolate(spring, translationX, 0)),
        cond(not(clockRunning(clock)), set(firstSelectionIsDone, 1))
      ]),
      ...cards.map((_, index) =>
        cond(and(firstSelectionIsDone, eq(selectedCard, index)), [
          set(spring, timing(clock)),
          ...cards
            .map((_c, i) => i)
            .filter((_c, i) => i !== index)
            .map((absoluteIndex, i) =>
              set(
                cardRotates[absoluteIndex],
                bInterpolate(
                  spring,
                  cardRotates[absoluteIndex],
github wcandillon / can-it-be-done-in-react-native / season2 / monzo-card-selection / components / CardSelection2.tsx View on Github external
cond(and(not(clockRunning(clock)), neq(nextIndex, selectedCard)), [
          set(selectedCard, nextIndex),
          call([selectedCard], selectCardState)
        ])
      ]),
      cond(eq(selectedCard, INITIAL_INDEX), [
        set(spring, timing(clock)),
        set(cardRotates[0], bInterpolate(spring, 0, -15)),
        set(cardRotates[1], 0),
        set(cardRotates[2], bInterpolate(spring, 0, 15))
      ]),
      cond(and(neq(selectedCard, INITIAL_INDEX), not(firstSelectionIsDone)), [
        set(spring, timing(clock)),
        set(cardRotates[0], bInterpolate(spring, 0, -7.5)),
        set(cardRotates[1], bInterpolate(spring, 0, 7.5)),
        set(cardRotates[2], bInterpolate(spring, 15, 0)),
        set(translationX, bInterpolate(spring, translationX, 0)),
        cond(not(clockRunning(clock)), set(firstSelectionIsDone, 1))
      ]),
      ...cards.map((_, index) =>
        cond(and(firstSelectionIsDone, eq(selectedCard, index)), [
          set(spring, timing(clock)),
          ...cards
            .map((_c, i) => i)
            .filter((_c, i) => i !== index)
            .map((absoluteIndex, i) =>
              set(
                cardRotates[absoluteIndex],
                bInterpolate(
                  spring,
                  cardRotates[absoluteIndex],
                  7.5 * (i % 2 === 0 ? -1 : 1)
github wcandillon / can-it-be-done-in-react-native / season2 / monzo-card-selection / components / CardSelection.tsx View on Github external
};
  useCode(
    block([
      cond(and(not(clockRunning(clock)), neq(nextIndex, selectedCard)), [
        set(selectedCard, nextIndex),
        call([selectedCard], selectCardState)
      ]),
      cond(eq(selectedCard, INITIAL_INDEX), [
        set(spring, timing(clock)),
        set(cardRotates[0], bInterpolate(spring, 0, -15)),
        set(cardRotates[1], 0),
        set(cardRotates[2], bInterpolate(spring, 0, 15))
      ]),
      cond(and(neq(selectedCard, INITIAL_INDEX), not(firstSelectionIsDone)), [
        set(spring, timing(clock)),
        set(cardRotates[0], bInterpolate(spring, 0, -7.5)),
        set(cardRotates[1], bInterpolate(spring, 0, 7.5)),
        set(cardRotates[2], bInterpolate(spring, 15, 0)),
        set(translationX, bInterpolate(spring, translationX, 0)),
        cond(not(clockRunning(clock)), set(firstSelectionIsDone, 1))
      ]),
      ...cards.map((_, index) =>
        cond(and(firstSelectionIsDone, eq(selectedCard, index)), [
          set(spring, timing(clock)),
          ...cards
            .map((_c, i) => i)
            .filter((_c, i) => i !== index)
            .map((absoluteIndex, i) =>
              set(
                cardRotates[absoluteIndex],
                bInterpolate(
                  spring,
github wcandillon / can-it-be-done-in-react-native / season2 / monzo-card-selection / components / CardSelection2.tsx View on Github external
.map((absoluteIndex, i) =>
              set(
                cardRotates[absoluteIndex],
                bInterpolate(
                  spring,
                  cardRotates[absoluteIndex],
                  7.5 * (i % 2 === 0 ? -1 : 1)
                )
              )
            ),
github wcandillon / can-it-be-done-in-react-native / season2 / monzo-card-selection / components / CardSelection2.tsx View on Github external
block([
      onChange(nextIndex, [
        cond(and(not(clockRunning(clock)), neq(nextIndex, selectedCard)), [
          set(selectedCard, nextIndex),
          call([selectedCard], selectCardState)
        ])
      ]),
      cond(eq(selectedCard, INITIAL_INDEX), [
        set(spring, timing(clock)),
        set(cardRotates[0], bInterpolate(spring, 0, -15)),
        set(cardRotates[1], 0),
        set(cardRotates[2], bInterpolate(spring, 0, 15))
      ]),
      cond(and(neq(selectedCard, INITIAL_INDEX), not(firstSelectionIsDone)), [
        set(spring, timing(clock)),
        set(cardRotates[0], bInterpolate(spring, 0, -7.5)),
        set(cardRotates[1], bInterpolate(spring, 0, 7.5)),
        set(cardRotates[2], bInterpolate(spring, 15, 0)),
        set(translationX, bInterpolate(spring, translationX, 0)),
        cond(not(clockRunning(clock)), set(firstSelectionIsDone, 1))
      ]),
      ...cards.map((_, index) =>
        cond(and(firstSelectionIsDone, eq(selectedCard, index)), [
          set(spring, timing(clock)),
          ...cards
            .map((_c, i) => i)
            .filter((_c, i) => i !== index)
            .map((absoluteIndex, i) =>
              set(
                cardRotates[absoluteIndex],
                bInterpolate(
                  spring,
github wcandillon / can-it-be-done-in-react-native / season2 / safari-tabs / components / Tab.tsx View on Github external
  const rotateX = useMemo(() => bInterpolate(transition, 0, -Math.PI / 6), [
    transition
github wcandillon / can-it-be-done-in-react-native / season2 / monzo-card-selection / components / CardSelection2.tsx View on Github external
set(selectedCard, nextIndex),
          call([selectedCard], selectCardState)
        ])
      ]),
      cond(eq(selectedCard, INITIAL_INDEX), [
        set(spring, timing(clock)),
        set(cardRotates[0], bInterpolate(spring, 0, -15)),
        set(cardRotates[1], 0),
        set(cardRotates[2], bInterpolate(spring, 0, 15))
      ]),
      cond(and(neq(selectedCard, INITIAL_INDEX), not(firstSelectionIsDone)), [
        set(spring, timing(clock)),
        set(cardRotates[0], bInterpolate(spring, 0, -7.5)),
        set(cardRotates[1], bInterpolate(spring, 0, 7.5)),
        set(cardRotates[2], bInterpolate(spring, 15, 0)),
        set(translationX, bInterpolate(spring, translationX, 0)),
        cond(not(clockRunning(clock)), set(firstSelectionIsDone, 1))
      ]),
      ...cards.map((_, index) =>
        cond(and(firstSelectionIsDone, eq(selectedCard, index)), [
          set(spring, timing(clock)),
          ...cards
            .map((_c, i) => i)
            .filter((_c, i) => i !== index)
            .map((absoluteIndex, i) =>
              set(
                cardRotates[absoluteIndex],
                bInterpolate(
                  spring,
                  cardRotates[absoluteIndex],
                  7.5 * (i % 2 === 0 ? -1 : 1)
                )
github wcandillon / can-it-be-done-in-react-native / the-10-min / src / components / Thumbnail.tsx View on Github external
export default ({
  title,
  source,
  onPress,
  dark,
  resizeMode,
  comingSoon
}: ThumbnailProps) => {
  const value = new Value(0);
  const scale = bInterpolate(value, 1, 1.5);
  return (
    <TapHandler {...{ onPress, value }}>
      <View style={styles.container}>
        <Animated.Image
          style={[
            styles.image,
            {
              resizeMode: resizeMode || "contain",
              transform: [{ scale }]
            }
          ]}
          {...{ source }}
        />
        <View style={styles.content}>
          {comingSoon && (
            <Text type="subhead" style={{ color: "#2F2E41" }}>
github wcandillon / can-it-be-done-in-react-native / season2 / monzo-card-selection / components / CardSelection.tsx View on Github external
const selectCard = (index: number) => {
    if (index !== selectedCardState) {
      nextIndex.setValue(index);
    }
  };
  useCode(
    block([
      cond(and(not(clockRunning(clock)), neq(nextIndex, selectedCard)), [
        set(selectedCard, nextIndex),
        call([selectedCard], selectCardState)
      ]),
      cond(eq(selectedCard, INITIAL_INDEX), [
        set(spring, timing(clock)),
        set(cardRotates[0], bInterpolate(spring, 0, -15)),
        set(cardRotates[1], 0),
        set(cardRotates[2], bInterpolate(spring, 0, 15))
      ]),
      cond(and(neq(selectedCard, INITIAL_INDEX), not(firstSelectionIsDone)), [
        set(spring, timing(clock)),
        set(cardRotates[0], bInterpolate(spring, 0, -7.5)),
        set(cardRotates[1], bInterpolate(spring, 0, 7.5)),
        set(cardRotates[2], bInterpolate(spring, 15, 0)),
        set(translationX, bInterpolate(spring, translationX, 0)),
        cond(not(clockRunning(clock)), set(firstSelectionIsDone, 1))
      ]),
      ...cards.map((_, index) =>
        cond(and(firstSelectionIsDone, eq(selectedCard, index)), [
          set(spring, timing(clock)),
          ...cards
            .map((_c, i) => i)
            .filter((_c, i) => i !== index)
            .map((absoluteIndex, i) =>