Skip to content

Instantly share code, notes, and snippets.

@ashrithks
Created March 20, 2018 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashrithks/0d88e6b1b721c8bc2a5ae6ae5ecb3ffd to your computer and use it in GitHub Desktop.
Save ashrithks/0d88e6b1b721c8bc2a5ae6ae5ecb3ffd to your computer and use it in GitHub Desktop.
let CollapseExpand = (index, position) => {
const inputRange = [index - 1, index, index + 1];
const opacity = position.interpolate({
inputRange,
outputRange: [0, 1, 1],
});
const scaleY = position.interpolate({
inputRange,
outputRange: ([0, 1, 1]),
});
return {
opacity,
transform: [
{ scaleY }
]
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment