【问题标题】:How to make bounce button animation in react-native如何在 react-native 中制作弹跳按钮动画
【发布时间】:2021-09-10 23:33:39
【问题描述】:

如果我们使用 css,我们可以归档弹跳按钮

.order {
  position: absolute;
  top: 50px;
  left: 50px;
  width: 75px;
  line-height: 75px;
  text-align:center;
  opacity: 1;
  background: green;
  color:#fff;
  border-radius:50%;
  -webkit-animation: bounce .3s infinite alternate;
  -moz-animation: bounce .3s infinite alternate;
  animation: bounce .3s infinite alternate;
}
@-webkit-keyframes bounce {
  to { -webkit-transform: scale(1.2); }
}
@-moz-keyframes bounce {
  to { -moz-transform: scale(1.2); }
}
@keyframes bounce {
  to { transform: scale(1.2); }

但问题是,react-native,我们不能使用像web-kit 这样的库,所以我想知道如何为按钮或更大的视图制作弹跳动画,如何在 react-native 应用程序中制作动画?

【问题讨论】:

    标签: javascript css reactjs react-native


    【解决方案1】:

    React Native 也支持 React Spring。你应该在 React native 中使用 React Spring 来制作动画。我附上了反弹效果的例子。 React Spring 网站上还有其他效果,如 Pulse、Hover 等。

    你应该看看 React Spring Docs。 https://codesandbox.io/s/github/pmndrs/react-spring/tree/master/demo/src/sandboxes/css-keyframes

    【讨论】:

    • 哇,lib 看起来很酷,谢谢你的回答
    • @LêQuốcKhánh 是的,出于动画目的,我一直使用 React Spring。
    猜你喜欢
    • 2019-08-15
    • 2023-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-30
    • 1970-01-01
    相关资源
    最近更新 更多