React native 如何从一个视图设置组件动画以降低DOM?

React native 如何从一个视图设置组件动画以降低DOM?,react-native,react-portal,React Native,React Portal,我在写一个纸牌游戏。我想制作一张从手持风扇到卡片桌的卡片的动画。一旦卡离开风扇视图,它就会消失。如何将其平滑地设置到显示的中间位置(DOM中较高的位置) 我想也许它可以与react native portal一起使用 这是卡片: return ( <View style={styles.outerContainer}> <Animated.View style={[styles.playerHandContainer, { width: contai

我在写一个纸牌游戏。我想制作一张从手持风扇到卡片桌的卡片的动画。一旦卡离开风扇视图,它就会消失。如何将其平滑地设置到显示的中间位置(DOM中较高的位置)

我想也许它可以与react native portal一起使用

这是卡片:

return (
      <View style={styles.outerContainer}>
        <Animated.View style={[styles.playerHandContainer, { width: containerAnimValue.x, //+ widthOffset, 
                              height: containerAnimValue.y }]}>
        {cards.map((card, idx) => {
          const { suit, number } = card

          const { x, y, angle } = coords[idx]
          const originalIndex = originalCards.indexOf(JSON.stringify(card))
          // const styleObject = { left: x + leftOffset, top: y, transform: [{ rotate: Math.round(angle) + 'deg' }]}
          const translationAnimValue = translationAnimationValues[originalIndex]

angle, number, originalIndex')
          const styleObject = { left: translationAnimValue.x, top: translationAnimValue.y, 
                                transform: [{ rotate: spins[originalIndex] }]}
          // the list is necessary because it doesn't give you the same results if you put the object directy in the jsx curlies
          return <AnimatedClassCard onPress={() => this.cardOnPress(card, cards, idx, coords, width, height)} 
                                    card={{ suit, number }} key={originalIndex} style={[styles.playerCards, styleObject]}
                                    renderCard={renderCard}/>

                }
            )
        }
        </Animated.View>
      </View>
返回(
{cards.map((card,idx)=>{
const{suit,number}=卡片
常数{x,y,angle}=coords[idx]
const originalIndex=originalCards.indexOf(JSON.stringify(card))
//constyleobject={left:x+leftOffset,top:y,transform:[{rotate:Math.round(angle)+'deg'}]}
const translationAnimValue=translationanimvalues[originalIndex]
角度、数字、原始索引’)
constyleObject={left:translationAnimValue.x,top:translationAnimValue.y,
变换:[{旋转:旋转[originalIndex]}]}
//该列表是必需的,因为如果将对象directy放入jsx卷曲中,它不会给出相同的结果
返回此。cardOnPress(卡,卡,idx,坐标,宽度,高度)}
卡片={{suit,number}}键={originalIndex}样式={[style.playerCards,styleObject]}
renderCard={renderCard}/>
}
)
}
卡应刚好从handfan容器移动到主容器,而不会消失