RN animated组动画
2024-08-22 19:16:21
代码:
export default class AnimationGroupScene extends Component { constructor() {
super()
this.animatedValue1 = new Animated.Value()
this.animatedValue2 = new Animated.Value()
this.animatedValue3 = new Animated.Value()
} componentDidMount() {
this.animate()
} animate() {
this.animatedValue1.setValue()
this.animatedValue2.setValue()
this.animatedValue3.setValue()
const createAnimation = function (value, duration, easing, delay = ) {
return Animated.timing(
value,
{
toValue: ,
duration,
easing,
delay
}
)
}
Animated.parallel([
createAnimation(this.animatedValue1, , Easing.ease),
createAnimation(this.animatedValue2, , Easing.ease, ),
createAnimation(this.animatedValue3, , Easing.ease, )
]).start()
} render() { const scaleText = this.animatedValue1.interpolate({
inputRange: [, ],
outputRange: [0.5, ]
})
const spinText = this.animatedValue2.interpolate({
inputRange: [, ],
outputRange: ['0deg', '720deg']
})
const introButton = this.animatedValue3.interpolate({
inputRange: [, ],
outputRange: [-, ]
}) return (
<View style={styles.container}>
<Animated.View
style={{transform: [{scale: scaleText}]}}>
<Text>Welcome</Text>
</Animated.View>
<Animated.View
style={{marginTop: , transform: [{rotate: spinText}]}}>
<Text
style={{fontSize: }}>
to the App!
</Text>
</Animated.View>
<Animated.View
style={{top: introButton, position: 'absolute'}}>
<TouchableHighlight
onPress={this.animate.bind(this)}
style={styles.button}>
<Text>启动组动画</Text>
</TouchableHighlight>
</Animated.View> </View>
);
}
} const styles = StyleSheet.create({
container: {
flex: ,
marginTop: ,
justifyContent: 'center',
alignItems: 'center',
},
button: {
marginTop: ,
backgroundColor: '#808080',
height: ,
width: ,
borderRadius: ,
justifyContent: 'center',
alignItems: 'center',
}, });
最新文章
- Software Solutions CACHE COHERENCE AND THE MESI PROTOCOL
- C# 更新SQL Server数据库备注信息从另一数据库
- 去掉IE下input的叉号
- CAS 4.0.0RC 配置MD5验证功能
- 发布在IIS的网站,可以用本机IP登录访问,用localhost不可登录访问
- UITableView小知识点总结
- BZOJ 3439 Kpm的MC密码
- 认识Java虚拟机的内部体系结构、gc示例
- Unity3D脚本使用:游戏对象访问
- for语句,你真正搞懂了吗?
- 安卓开发:简单的登陆跳转_APK实现直接跳转到本CSDN博客
- 数据库子查询和join的比较
- Django富文本需要添加配置
- Liblinear and Libsvm-rank训练数据的bash代码
- 关于阿里云Centos服务器搭建Java网站不能访问的问题
- 解决python3.6的UnicodeEncodeError: &#39;gbk&#39; codec can&#39;t encode character &#39;\xbb&#39; in position 28613: illegal multibyte sequence
- mysql 移除服务,并在cmd下切换目录
- 记一次加载js不全报错的原因总结
- 股票F10
- 蓝桥杯 C/C++参考题目 取球概率(数学题,概率)
热门文章
- Hdg Remote Debug
- 巧妙解决windows下 copy命令不接受太长路径的问题
- python multiprocess pool模块报错pickling error
- yum 快速安装centos7 mysql5.7
- ThinkingInJava 学习 之 0000006 复用类
- Spring Boot 集成 Redis 实现缓存机制
- Unity3D 优化NGUI纹理
- NIO相关概念之Channel
- day_6.6 py
- CentOS 7.4下使用yum安装MySQL5.7.20 最简单的 (引用)