RN animated缩放动画
效果图:

代码:
import React, {Component} from 'react';
import {
AppRegistry,
StyleSheet,
Text,
Animated,
TouchableOpacity,
View
} from 'react-native';
export default class AnimationSpringScene extends Component {
constructor(props) {
super(props);
this.springValue = new Animated.Value(0.3)
}
componentDidMount() {
this.spring()
}
spring() {
this.springValue.setValue(0.3)
Animated.spring(
this.springValue,
{
toValue: 1,
friction: 1
}
).start()
}
render() {
return (
<View style={styles.container}>
<Animated.Image
style={{width: 227, height: 200, transform: [{scale: this.springValue}]}}
source={{uri: 'https://s3.amazonaws.com/media-p.slid.es/uploads/alexanderfarennikov/images/1198519/reactjs.png'}}/>
<TouchableOpacity onPress={() => this.spring()} style={styles.button}>
<Text>启动动画</Text>
</TouchableOpacity>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
marginTop: 20,
justifyContent: 'center',
alignItems: 'center',
},
button: {
marginTop: 20,
backgroundColor: '#808080',
height: 35,
width: 140,
borderRadius: 5,
justifyContent: 'center',
alignItems: 'center',
},
});
RN animated缩放动画的更多相关文章
- RN animated组动画
代码: export default class AnimationGroupScene extends Component { constructor() { super() ) ) ) } com ...
- 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. ...
- POP缩放动画
POP缩放动画 效果 源码 https://github.com/YouXianMing/Animations // // SpringScaleViewController.m // Animati ...
- UILabel的缩放动画效果
UILabel的缩放动画效果 效果图 源码 https://github.com/YouXianMing/Animations // // ScaleLabel.h // Animations // ...
- UITableView的headerView展开缩放动画
UITableView的headerView展开缩放动画 效果 源码 https://github.com/YouXianMing/Animations // // HeaderViewTapAnim ...
- iOS项目开发实战——制作视图的缩放动画
视图的大小应该是随时可控的.今天我们就来实现对一个View的缩放动画.该动画的实现与位移动画,透明度动画稍有不同. 详细实现例如以下: import UIKit class ScaleViewCont ...
- Android实现Layout缩放动画
最近看到Any.do的缩放效果很酷,看到一篇讲Layout缩放动画实现的文章,记录一下: http://edison-cool911.iteye.com/blog/704812
- 动画--问题追踪:ImageView执行缩放动画ScaleAnimation之后,图像显示不全的问题。
http://www.bkjia.com/Androidjc/929473.html: 问题追踪:ImageView执行缩放动画ScaleAnimation之后,图像显示不全的问题., 问题:我有一个 ...
随机推荐
- Netbeans 8.1 检测不到Tomcat8.5.3以上版本已经启动的Bug
Tomcat实际上已经启动,但是netbeans就是检测不到,只要在server.xml中,找到http/1.1的connector 添加 属性 server="Apache-Coyote/ ...
- Android异步处理系列文章四篇之一使用Thread+Handler实现非UI线程更新UI界面
目录: Android异步处理一:使用Thread+Handler实现非UI线程更新UI界面Android异步处理二:使用AsyncTask异步更新UI界面Android异步处理三:Handler+L ...
- iOS开发-- Xcode 6单元测试
占坑 http://m.oschina.net/blog/377800 http://www.cnblogs.com/sunshine-anycall/p/4155649.html http://ob ...
- JQuery EasyUI DataGrid获取当前行
1.获取当前行索引 var rowIndex = $('#dg').datagrid('getRowIndex', row); 2.根据索引删除当前行 $('#dg').datagrid('delet ...
- vc写的dll被mingw的g++编译引用
dll.cpp,用vc2017编译 #include <iostream>#include <windows.h> extern "C" __declspe ...
- css sprite---css精灵网页图片应用处理方式分析
CSSSprites,在前端图片处理中经常用到的一种高效方法,下面参考百度百科的总结,非常到位,学习一下吧! CSSSprites在国内很多人叫css精灵,是一种网页图片应用处理方式.它允许你将一个页 ...
- C#打印标签
一个复杂的标签包括一个复杂的表格样式和二维码.条形码等内容.所以如果直接绘制的方式将会非常的麻烦,所以采用使用的方案是使用模板的方式:1.使用Excel创建出想要的模板的样式.2.对模板中的动态内容进 ...
- 编译openssl失败(SLES11.3), undefined reference to `OPENSSL_cpuid_setup'
https://stackoverflow.com/questions/11381514/undefined-reference-when-compiling-openssl I ran into t ...
- Windows的文件类型关联
在用脚本语言开发时尤其是在windows环境下发现想自动在命令行环境下运行脚本必须要带着相应的解释器的路径才行,不然就会提示无法找到对应的命令,于是乎在<学习Ruby>这本书中对于文件类型 ...
- ASP.NET Core 实现用户登录验证的最低配置
背景是在一个项目中增加临时登录功能,只需验证用户是否登录即可,所需的最低配置与实现代码如下. 在 Startup 的 ConfigureServices() 方法中添加 Authentication ...