Skip to content

Commit

Permalink
💚 (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcandillon authored Sep 12, 2020
1 parent 41ca495 commit aca8970
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/v1/Colors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Animated from "react-native-reanimated";
import { processColor } from "react-native";
import interpolateNode, { Extrapolate } from "react-native-reanimated/src/derived/interpolate";
import interpolateNode, {
Extrapolate,
} from "react-native-reanimated/src/derived/interpolate";

import { mix } from "./Animations";
import { clamp, fract } from "./Math";
Expand Down Expand Up @@ -118,17 +120,17 @@ const interpolateColorsHSV = (
const h = interpolateNode(animationValue, {
inputRange,
outputRange: colorsAsHSV.map((c) => c.h),
extrapolate: Extrapolate.CLAMP
extrapolate: Extrapolate.CLAMP,
});
const s = interpolateNode(animationValue, {
inputRange,
outputRange: colorsAsHSV.map((c) => c.s),
extrapolate: Extrapolate.CLAMP
extrapolate: Extrapolate.CLAMP,
});
const v = interpolateNode(animationValue, {
inputRange,
outputRange: colorsAsHSV.map((c) => c.v),
extrapolate: Extrapolate.CLAMP
extrapolate: Extrapolate.CLAMP,
});
return hsv2color(h, s, v);
};
Expand All @@ -142,27 +144,27 @@ const interpolateColorsRGB = (
interpolateNode(animationValue, {
inputRange,
outputRange: colors.map((c) => red(c)),
extrapolate: Extrapolate.CLAMP
extrapolate: Extrapolate.CLAMP,
})
);
const g = round(
interpolateNode(animationValue, {
inputRange,
outputRange: colors.map((c) => green(c)),
extrapolate: Extrapolate.CLAMP
extrapolate: Extrapolate.CLAMP,
})
);
const b = round(
interpolateNode(animationValue, {
inputRange,
outputRange: colors.map((c) => blue(c)),
extrapolate: Extrapolate.CLAMP
extrapolate: Extrapolate.CLAMP,
})
);
const a = interpolateNode(animationValue, {
inputRange,
outputRange: colors.map((c) => opacity(c)),
extrapolate: Extrapolate.CLAMP
extrapolate: Extrapolate.CLAMP,
});

return color(r, g, b, a);
Expand Down

0 comments on commit aca8970

Please sign in to comment.