Skip to content

Commit

Permalink
Update interpolateColor example (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
jozan authored and wcandillon committed Nov 21, 2019
1 parent 16899bd commit 06025f4
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,28 +366,38 @@ interpolateColor(value: Node, { inputRange: number[], outputRange: Colors }, col
Example Usage:
```js
const from = {
r: 197,
g: 43,
b: 39
};
const to = {
r: 225,
g: 176,
b: 68
};
const from = { r: 197, g: 43, b: 39 };
const to = { r: 225, g: 176, b: 68 };

// Interpolate in default color space (HSV)
interpolateColor(x, [0, 1], [from, to]);
// Interpolate in RGB color space (default)
interpolateColor(node, {
inputRange: [0, 100],
outputRange: [from, to]
});

// Interpolate in RGB color space
interpolateColor(x, [0, 1], [from, to], "rgb");
// Interpolate in HSV color space
interpolateColor(
clampedScroll,
{
inputRange: [0, 1],
outputRange: [from, to]
},
"hsv"
);
```
### `bInterpolateColor(node, color1, color2, [colorSpace = "rgb"])`
Interpolate the node from 0 to 1 without clamping.
```js
const from = { r: 197, g: 43, b: 39 };
const to = { r: 225, g: 176, b: 68 };

bInterpolateColor(node, from, to);
```
### `snapPoint(point, velocity, points)`
Select a point based on a node value and its velocity.
Expand Down

0 comments on commit 06025f4

Please sign in to comment.