I’m using Animated for web and I’m wondering is it possible to use Animated Values in a Glamorous component?
Like:
const AnimatedImageContainer = glamorous(Animated.div)(({ translateY }) => ({
transform: `translateY(${translateY._value}px)`,
}));
<AnimatedImageContainer
translateY={this.state.anim.interpolate({
inputRange: [-200, 100],
outputRange: [200, 0],
extrapolate: 'clamp',
})}
>
<AnimatedImage src={image} />
</AnimatedImageContainer>
Or like:
<AnimatedImageContainer
css={{
transform: [
{
translateY: this.state.anim.interpolate({
inputRange: [-200, 100],
outputRange: [200, 0],
extrapolate: 'clamp',
}),
},
],
}}
>
<AnimatedImage src={image} />
</AnimatedImageContainer>
Similar to React Native you can wrap your component in
createAnimatedComponent()
.Something like this (https://codesandbox.io/s/93202y1qyo):