Javascript 使用“useNativeDriver”在React native中将圆动画化为具有圆角边的正方形`
我有一个形状,我想动画从圆形,到一个正方形与圆形的边缘Javascript 使用“useNativeDriver”在React native中将圆动画化为具有圆角边的正方形`,javascript,react-native,expo,Javascript,React Native,Expo,我有一个形状,我想动画从圆形,到一个正方形与圆形的边缘 <Animated.View style={[{ width : this.state.innerWidth , height : this.state.innerWidth , borderRadius: this.state.inn
<Animated.View
style={[{
width : this.state.innerWidth
, height : this.state.innerWidth
, borderRadius: this.state.innerRadius
, transform : [{scale:this.state.scale}]
, backgroundColor: this.state.color
, opacity : this.state.opacityInner
}]}
/>
不提供类似的属性 似乎适用于borderRadius
。高度等属性可能不支持本机动画
import React, { Component } from "react";
import { View, Animated } from "react-native";
class App extends Component {
state = {
borderRadius: new Animated.Value(100)
};
componentDidMount() {
Animated.timing(this.state.borderRadius, {
toValue: 16,
duration: 1200,
useNativeDriver: true
}).start();
}
render() {
return (
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
<Animated.View
style={{
height: 200,
width: 200,
borderRadius: this.state.borderRadius,
backgroundColor: "red"
}}
/>
</View>
);
}
}
export default App;
import React,{Component}来自“React”;
从“react native”导入{View,Animated};
类应用程序扩展组件{
状态={
borderRadius:新动画。值(100)
};
componentDidMount(){
动画。计时(this.state.borderRadius{
toValue:16,
持续时间:1200,
useNativeDriver:真的吗
}).start();
}
render(){
返回(