Slow down and enlarge post-ctrl animations (close #11)

zio/stable
Paul Frazee 2022-11-28 10:40:25 -06:00
parent 0e6237e58c
commit b9c9895c45
1 changed files with 4 additions and 4 deletions

View File

@ -31,17 +31,17 @@ export function PostCtrls(opts: PostCtrlsOpts) {
const interp2 = useSharedValue<number>(0) const interp2 = useSharedValue<number>(0)
const anim1Style = useAnimatedStyle(() => ({ const anim1Style = useAnimatedStyle(() => ({
transform: [{scale: interpolate(interp1.value, [0, 1.0], [1.0, 3.0])}], transform: [{scale: interpolate(interp1.value, [0, 1.0], [1.0, 4.0])}],
opacity: interpolate(interp1.value, [0, 1.0], [1.0, 0.0]), opacity: interpolate(interp1.value, [0, 1.0], [1.0, 0.0]),
})) }))
const anim2Style = useAnimatedStyle(() => ({ const anim2Style = useAnimatedStyle(() => ({
transform: [{scale: interpolate(interp2.value, [0, 1.0], [1.0, 3.0])}], transform: [{scale: interpolate(interp2.value, [0, 1.0], [1.0, 4.0])}],
opacity: interpolate(interp2.value, [0, 1.0], [1.0, 0.0]), opacity: interpolate(interp2.value, [0, 1.0], [1.0, 0.0]),
})) }))
const onPressToggleRepostWrapper = () => { const onPressToggleRepostWrapper = () => {
if (!opts.isReposted) { if (!opts.isReposted) {
interp1.value = withTiming(1, {duration: 300}, () => { interp1.value = withTiming(1, {duration: 400}, () => {
interp1.value = withDelay(100, withTiming(0, {duration: 20})) interp1.value = withDelay(100, withTiming(0, {duration: 20}))
}) })
} }
@ -49,7 +49,7 @@ export function PostCtrls(opts: PostCtrlsOpts) {
} }
const onPressToggleUpvoteWrapper = () => { const onPressToggleUpvoteWrapper = () => {
if (!opts.isUpvoted) { if (!opts.isUpvoted) {
interp2.value = withTiming(1, {duration: 300}, () => { interp2.value = withTiming(1, {duration: 400}, () => {
interp2.value = withDelay(100, withTiming(0, {duration: 20})) interp2.value = withDelay(100, withTiming(0, {duration: 20}))
}) })
} }