Created
June 20, 2022 12:11
-
-
Save itsramiel/c8bb5ce0ab6cf0132d648f158c855c64 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const style2 = useAnimatedStyle(() => { | |
const SHORTENED_HEIGHT = VIEW_HEIGHT * 0.3; | |
const width = interpolate( | |
progress.value, | |
[0, 1], | |
[VIEW_HEIGHT, SHORTENED_HEIGHT] | |
); | |
const deg = interpolate(progress.value, [0, 1], [0, 50]); | |
const translateY = interpolate( | |
progress.value, | |
[0, 1], | |
[0, VIEW_HEIGHT / 2 - VIEW_WIDTH / 2] | |
); | |
const translateX = -interpolate( | |
progress.value, | |
[0, 1], | |
[0, SHORTENED_HEIGHT / 2 - VIEW_WIDTH / 2] | |
); | |
return { | |
width: width, | |
height: VIEW_WIDTH, | |
backgroundColor: "white", | |
position: "absolute", | |
top: FAB_SIZE / 2 - VIEW_WIDTH / 2, | |
left: FAB_SIZE / 2 - width / 2, | |
transform: [{ rotate: `${deg}deg` }, { translateY }, { translateX }], | |
}; | |
}, []); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment