javascript - 动画被执行,但随后立即返回初始状态
问题描述
这是我的代码,我正在调用状态更改。它被执行,但随后立即返回其初始状态。我想让它保持它的位置,直到我告诉它。
const spinValue = new Animated.Value(0)
const widthValueX = new Animated.Value(0)
const open = () => {
Animated.spring(widthValueX, {toValue: 2, useNativeDriver: true}).start()
Animated.spring(spinValue, {toValue: 2, useNativeDriver: true}).start()
}
const growX = widthValueX.interpolate({
inputRange: [0, 1, 2],
outputRange: [1, 1.5, 1]
})
const spinX = spinValue.interpolate({
inputRange: [0, 1, 2],
outputRange: ['0deg', '45deg', '90deg']
})
解决方案
推荐阅读
- c# - 如何从 Firebase 获取数据快照一次且仅一次(使用 C#)?
- jupyter-notebook - 如何在 IPython 魔术命令后添加评论
- c# - 为什么我无法将 xamarin.ios 应用部署到我的设备?
- unit-testing - Spring集成测试流程异常
- javascript - Summernote 在合并段落后添加跨度
- python - 如何使for循环中的语句超时
- ios - 如何将 UIImagePickerController 限制为仅选择纵向模式(深度效果)照片?
- python-3.x - 在 keras 回调中监控 F1 分数(或一般的自定义指标)
- c# - 如何将文件从 umbraco 后台上传到媒体部分?
- spring-kafka - Kafka Spring:如何为 ConcurrentKafkaListenerContainerFactory 和 ConcurrentMessageListenerContainer 编写单元测试?