Javascript 如何在单个轴上制作图像动画,例如,在水平轴或垂直轴上进行特定旋转

Javascript 如何在单个轴上制作图像动画,例如,在水平轴或垂直轴上进行特定旋转,javascript,reactjs,react-native,Javascript,Reactjs,React Native,我试图旋转一个图像,它基本上是显示硬币被翻转(硬币投掷动画)我已经将这个基本动画应用到图像上,但它没有得到动画 我在emulator上测试时,图像是静止的 这是我的index.android.js文件: import React,{Component}来自'React'; 进口{ 评估学, 看法 有生气的 缓和 }从“反应本机”; 导出默认类animateTest扩展组件{ 建造师(道具){ 超级(道具); this.spinValue=新的动画.Value(0); } componentDi

我试图旋转一个图像,它基本上是显示硬币被翻转(硬币投掷动画)我已经将这个基本动画应用到图像上,但它没有得到动画

我在emulator上测试时,图像是静止的

这是我的index.android.js文件:

import React,{Component}来自'React';
进口{
评估学,
看法
有生气的
缓和
}从“反应本机”;
导出默认类animateTest扩展组件{
建造师(道具){
超级(道具);
this.spinValue=新的动画.Value(0);
}
componentDidMount(){
这个.spin();
}
自旋(){
此.spinValue.setValue(0);
时间(
这个值{
toValue:1,
持续时间:1500,
放松:放松,线性,
}
).start();
}
render(){
常量自旋=this.spinValue.interpolate({
输入范围:[0,1],
输出范围:['0deg','1440deg'],
useNativeDriver:真的吗
});
返回(
);
}
}
常量样式={
视图样式:{
弹性:1,
为内容辩护:“中心”,
对齐项目:“居中”,
背景颜色:“黑色”,
}
};

AppRegistry.registerComponent('animateTest',()=>animateTest)我知道怎么做了

-这只是我在动画中添加rotateX的一个小改动

代码如下:

import React,{Component}来自'React';
进口{
评估学,
看法
有生气的
缓和
}从“反应本机”;
导出默认类animateTest扩展组件{
建造师(道具){
超级(道具);
this.spinValue=新的动画.Value(0);
}
componentDidMount(){
这个.spin();
}
自旋(){
此.spinValue.setValue(0);
时间(
这个值{
toValue:1,
持续时间:1500,
放松:放松,线性,
}
).start();
}
render(){
常量自旋=this.spinValue.interpolate({
输入范围:[0,1],
输出范围:['0deg','1440deg'],
useNativeDriver:真的吗
});
返回(
);
}
}
常量样式={
视图样式:{
弹性:1,
为内容辩护:“中心”,
对齐项目:“居中”,
背景颜色:“黑色”,
}
};
AppRegistry.registerComponent('animateTest',()=>animateTest)