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之后,图像显示不全的问题., 问题:我有一个 ...
随机推荐
- Mysql 查看连接数,状态 最大并发数 && 怎么设置才合理
show status like '%max_connections%'; ##mysql最大连接数 set global max_connections=1000 ##重新设置 show varia ...
- python模块和类的通用转换规则(2),三步转oo
介绍模块和类怎么互相转换,不谈面向对象的继承 封装 多态等特点. 一个person_module模块,有人的基本属性和功能. person_module.py如下 # coding=utf8 name ...
- [AWS] Serverless
先来个热身 一整套方案,构建移动消息收发应用程序 (iOS) 要实现的目标: 使用 AWS Mobile Hub 为聊天应用程序配置移动云计算后端基础设施. 使用 Amazon Cognito 配置适 ...
- scrapy爬取某网站,模拟登陆过程中遇到的那些坑
本节内容 在访问网站的时候,我们经常遇到有些页面必须用户登录才能访问.这个时候我们之前写的傻傻的爬虫就被ban在门外了.所以本节,我们给爬虫配置cookie,使得爬虫能保持用户已登录的状态,达到获得那 ...
- spark基础---->spark的第一个程序
这里面我们介绍一下spark的安装,并通过一个python的例子来简单的体会一下spark的使用. spark的安装与使用 安装环境:mac 10.13.6,spark版本:2.3.1,python版 ...
- 【JavaScript】--- ES6/ES7/ES8
一.async async其实是ES7才有有的关键字,async的意思是异步,顾名思义是有关异步的操作 async用于声明一个函数是异步的. 通常情况下async.await都是跟随promise一起 ...
- ubuntu部署git
先更新本机内置的程序. sudo apt-get updatesudo apt-get upgrade再判断系统是否内置了add-apt-repository命令,如果没有执行下列命令安装 sudo ...
- 网络通信协议五之IP协议详解
网络层协议 >>IP协议 >>ARP(地址解析协议) >>RARP(反向地址解析协议) >>ICMP(互联网控制消息协议) IP协议功能 >> ...
- C# 方法中的this参数
x 先看下面的代码: public static class StringExtension { public static void Foo(this string s) { Console.Wri ...
- window.onresize监听事件
window.onresize监听事件 onresize 事件会在窗口或框架被调整大小时发生. 支持onresize的标签:<a>, <address>, <b>, ...