RN animated组动画

代码:
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',
},
});
RN animated组动画的更多相关文章
- RN animated缩放动画
效果图: 代码: import React, {Component} from 'react'; import { AppRegistry, StyleSheet, Text, Animated, T ...
- RN Animated透明度动画
主要代码解析: 如果我们希望吧Animated.Value从0变化到1,把组件位置从60px移动到0px,把不透明度从0编导1,就可以使用style的属性来实现 <Animated.Text s ...
- RN animated帧动画
效果图: 代码: export default class AnimationFrameScene extends Component { constructor () { super() this. ...
- iOS开发UI篇—核心动画(转场动画和组动画)
转自:http://www.cnblogs.com/wendingding/p/3801454.html iOS开发UI篇—核心动画(转场动画和组动画) 一.转场动画简单介绍 CAAnimation的 ...
- Core Animation中的组动画
实际开发中一个物体的运动往往是复合运动,单一属性的运动情况比较少,但恰恰属性动画每次进行动画设置时一次只能设置一个属性进行动画控制(不管是 基础动画还是关键帧动画都是如此),这样一来要做一个复合运动的 ...
- Vue系列之 => 使用第三方animated.css动画
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- react-native Animated, 旋转动画
Animated 仅封装了四个可以动画化的组件: View.Text.Image.ScrollView 可以使用 Animated.createAnimatedComponent()来封装你自己的组件 ...
- animated js动画示例
function fabtn(a){ $(a).find('i').addClass('animated wobble'); setTimeout(function(){ $(a).find('i') ...
- CSS属性组-动画、转换、渐变
一.动画 animation动画属性是一个简写属性,用于设置六个动画属性 aninmation-name动画名称,被调用 animation-duration完成动画需要的持续时间 animation ...
随机推荐
- Python 函数(可变参数)
在python函数中,可以定义可变参数,顾名思义,可变参数就是,传入的参数是可变的例如,给定一组数字a,b,c... 请计算a2 + b2 + c2 + …… 要定义出这个函数,我们必须确定输入的参 ...
- umi怎么去添加配置式路由
今天在学习umi,他的路由机制非常的方便,但是在学到配置式路由的时候,看官方文档里面一笔带过: 对于我这种小萌新来说,有点懵,我需要把配置文件放到哪里呢?经过一番研究,发现它是放在根目录的.umirc ...
- websql的使用/phonegap操作数据库 sqlite
对websql的常用操作进行了一个封装,项目是基于phonegap的,不过phonegap默认已经集成了数据库操作的插件,所以无需再配置什么,直接用就可以了: /** *数据库操作辅助类,定义对象.数 ...
- 前端html、CSS快速编写代码插件-Emmet使用方法技巧详解
前端html.CSS快速编写代码插件-Emmet使用方法技巧详解 Emmet的前身是大名鼎鼎的Zen coding,如果你从事Web前端开发的话,对该插件一定不会陌生.它使用仿CSS选择器的语法来 ...
- sencha touch 带本地搜索功能的selectfield(选择插件)
带本地搜索功能的选择插件,效果图: 在使用selectfield的过程中,数据过大时,数据加载缓慢,没有模糊查询用户体验也不好, 在selectfield的基础上上稍作修改而成,使用方式同select ...
- Javascript阿拉伯数字转中文
Javascript阿拉伯数字转中文 template.helper('_toChinese', function (number) { /* * 单位 */ var units = '个十百千万@# ...
- 【CF717G】Underfail 费用流
[CF717G]Underfail 题意:赌城拉斯维起司的赌场最近推出了一种新式赌法.它的玩法是由庄家(Joker)设局,赌徒只需要交付一定数额的赌资即可入局.具体地,Joker将给出一个长度为 $n ...
- windows下模拟网络延时、丢包、抖动
1.Fiddler 免费软件 模拟网速功能比较单一(Rules --> Performance --> Simulate Modem speed),选项较少,Fiddler仅是减缓带宽并未 ...
- struts2常用标签详解(申明:来源于网络)
struts2常用标签详解(申明:来源于网络) 地址:http://blessht.iteye.com/blog/1184960
- ELK之使用metricbeat收集系统数据及其他程序并生成可视化图表
将 Metricbeat 部署到您所有的 Linux.Windows 和 Mac 主机,并将它连接到 Elasticsearch 就大功告成啦:您可以获取系统级的 CPU 使用率.内存.文件系统.磁盘 ...