效果图:

代码:

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缩放动画的更多相关文章

  1. RN animated组动画

    代码: export default class AnimationGroupScene extends Component { constructor() { super() ) ) ) } com ...

  2. RN Animated透明度动画

    主要代码解析: 如果我们希望吧Animated.Value从0变化到1,把组件位置从60px移动到0px,把不透明度从0编导1,就可以使用style的属性来实现 <Animated.Text s ...

  3. RN animated帧动画

    效果图: 代码: export default class AnimationFrameScene extends Component { constructor () { super() this. ...

  4. POP缩放动画

    POP缩放动画 效果 源码 https://github.com/YouXianMing/Animations // // SpringScaleViewController.m // Animati ...

  5. UILabel的缩放动画效果

    UILabel的缩放动画效果 效果图 源码 https://github.com/YouXianMing/Animations // // ScaleLabel.h // Animations // ...

  6. UITableView的headerView展开缩放动画

    UITableView的headerView展开缩放动画 效果 源码 https://github.com/YouXianMing/Animations // // HeaderViewTapAnim ...

  7. iOS项目开发实战——制作视图的缩放动画

    视图的大小应该是随时可控的.今天我们就来实现对一个View的缩放动画.该动画的实现与位移动画,透明度动画稍有不同. 详细实现例如以下: import UIKit class ScaleViewCont ...

  8. Android实现Layout缩放动画

    最近看到Any.do的缩放效果很酷,看到一篇讲Layout缩放动画实现的文章,记录一下: http://edison-cool911.iteye.com/blog/704812

  9. 动画--问题追踪:ImageView执行缩放动画ScaleAnimation之后,图像显示不全的问题。

    http://www.bkjia.com/Androidjc/929473.html: 问题追踪:ImageView执行缩放动画ScaleAnimation之后,图像显示不全的问题., 问题:我有一个 ...

随机推荐

  1. 修改git用户密码

    第一步:登录git服务器: 第二步:切换到git用户 su git 第三步:登录GitLab的Rails控制台(GitLab使用RoR语言开发), gitlab-rails console produ ...

  2. Python默认参数的坑

    默认参数的坑 定义一个函数,传入一个list,添加一个end再返回 def add_end(L=[]): L.append('END') return L 正常调用时,结果似乎不错 print add ...

  3. [Bayes] prod: M-H: Independence Sampler for Posterior Sampling

    M-H是Metropolis抽样方法的扩展,扩展后可以支持不对称的提议分布. 对于M-H而言,根据候选分布g的不同选择,衍生出了集中不同的变种: (1)Metropolis抽样方法 (2)随机游动Me ...

  4. MySQL 无法连接

    Host 'localhost' is not allowed to connect to this MySQL server 错误 解决办法: C:\Program Files\MySQL\MySQ ...

  5. 132、Android安全机制(2) Android Permission权限控制机制(转载)

    http://blog.csdn.net/vshuang/article/details/44001661 http://www.cnblogs.com/mengdd/p/4892856.html

  6. JS 使用html2canvas实现截图功能的问题记录和解决方案

    在实现“截图”功能时,遇到几个bug,研究了一个上午,终于全部解决了: 下面给大家分享下: 1."图片资源跨域",导致无法截图. 浏览器会提示下面的错误 DOMException: ...

  7. qt tableWidget 表格控件使用

    //创建表格头 (灰色冻结状态的) QStringList header; header<<"Time"<<" ID "<< ...

  8. 高斯混合模型 GMM

    本文将涉及到用 EM 算法来求解 GMM 模型,文中会涉及几个统计学的概念,这里先罗列出来: 方差:用来描述数据的离散或波动程度. \[var(X) =  \frac{\sum_{i=1}^N( X_ ...

  9. Nordic NRF51822 从零开始系列(一)开发环境的搭建

    硬件准备     (1)nrf51822 开发板一块(此处使用的是青云系列的,自带jlijnk ob+usb串口芯片)或者使用nrf51822模块+jlink_ob                 ( ...

  10. [No0000F8]override和new的区别

    override 1. override是派生类用来重写(或覆盖)基类中方法的: 2. override不能重写非虚方法和静态方法: 3. override只能重写用virtual.abstract. ...