POP缩放动画

效果

源码

https://github.com/YouXianMing/Animations

//
// SpringScaleViewController.m
// Animations
//
// Created by YouXianMing on 16/6/3.
// Copyright © 2016年 YouXianMing. All rights reserved.
// #import "SpringScaleViewController.h"
#import "UIView+SetRect.h"
#import "UIFont+Fonts.h"
#import "GCD.h"
#import "POP.h" @interface SpringScaleViewController () @property (nonatomic, strong) UIView *scaleView; @end @implementation SpringScaleViewController - (void)setup { [super setup]; // Label
UILabel *label = [[UILabel alloc] init];
label.text = @"P P";
label.font = [UIFont HYQiHeiWithFontSize:];
[label sizeToFit];
label.center = self.contentView.middlePoint;
[self.contentView addSubview:label]; // Circle
self.scaleView = [[UIView alloc] initWithFrame:CGRectMake(, , , )];
self.scaleView.backgroundColor = [[UIColor colorWithRed:0.203 green:0.598 blue:0.859 alpha:] colorWithAlphaComponent:0.95f];
self.scaleView.layer.cornerRadius = self.scaleView.width / .f;
self.scaleView.center = self.contentView.middlePoint;
[self.contentView addSubview:self.scaleView]; // Start animation after 1 second.
[GCDQueue executeInMainQueue:^{ [self scaleAnimation]; } afterDelaySecs:.f];
} - (void)scaleAnimation { POPBasicAnimation *scaleAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewScaleXY]; scaleAnimation.name = @"scaleSmallAnimation";
scaleAnimation.delegate = self; scaleAnimation.duration = 0.15f;
scaleAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(1.25, 1.25)];\ [self.scaleView pop_addAnimation:scaleAnimation forKey:nil];
} - (void)pop_animationDidStop:(POPAnimation *)anim finished:(BOOL)finished { if ([anim.name isEqualToString:@"scaleSmallAnimation"]) { POPSpringAnimation *scaleAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewScaleXY]; scaleAnimation.name = @"SpringAnimation";
scaleAnimation.delegate = self; scaleAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(, )];
scaleAnimation.velocity = [NSValue valueWithCGPoint:CGPointMake(-, -)];
scaleAnimation.springBounciness = .f;
scaleAnimation.springSpeed = .f;
scaleAnimation.dynamicsTension = .f;
scaleAnimation.dynamicsFriction = .f;
scaleAnimation.dynamicsMass = .f; [self.scaleView pop_addAnimation:scaleAnimation forKey:nil]; } else if ([anim.name isEqualToString:@"SpringAnimation"]) { [self performSelector:@selector(scaleAnimation) withObject:nil afterDelay:];
}
} - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [[self class] cancelPreviousPerformRequestsWithTarget:self];
} @end

细节

1. 参数设置有技巧,可以参考如下所示(项目中的POPSpringParameterController):

2. 动画效果是通过组合两个动画而来的,要注意设置代理:

POP缩放动画的更多相关文章

  1. Android实现Layout缩放动画

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

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

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

  3. iOS开发笔记10:圆点缩放动画、强制更新、远程推送加语音提醒及UIView截屏

    1.使用CAReplicatorLayer制作等待动画 CALayer+CABasicAnimation可以制作很多简单的动画效果,之前的博客中介绍的“两个动画”,一个是利用一张渐变色图片+CABas ...

  4. iOS利用Runtime自定义控制器POP手势动画

    前言 苹果在iOS 7以后给导航控制器增加了一个Pop的手势,只要手指在屏幕边缘滑动,当前的控制器的视图就会跟随你的手指移动,当用户松手后,系统会判断手指拖动出来的大小来决定是否要执行控制器的Pop操 ...

  5. AndroidUI 视图动画-缩放动画效果 (ScaleAnimation)

    放动画效果,可以使用ScaleAnimation: <Button android:id="@+id/btnScale2" android:layout_width=&quo ...

  6. AndroidTv Home界面实现原理(二)——Leanback 库的主页卡位缩放动画源码解析

    先看个效果图: 上一篇中,我们留了问题,在 Tv Home 界面这种很常见聚焦卡位放大动画效果,我们这一篇就来看看 Leanback 库是怎么实现的. 如果要我们自己实现的话,思路应该不难,就是写个放 ...

  7. Android缩放动画

    Android缩放动画 核心方法 public void startAnimation(Animation animation) 执行动画,参数可以是各种动画的对象,Animation的多态,也可以是 ...

  8. pop弹簧动画实现

    POP是一个在iOS与OS X上通用的极具扩展性的动画引擎.它在基本的静态动画的基础上增加的弹簧动画与衰减动画,使之能创造出更真实更具物理性的交互动画.POP的API可以快速的与现有的ObjC代码集成 ...

  9. UI设计篇·入门篇·简单动画的实现,透明动画/旋转动画/移动动画/缩放动画,混合动画效果的实现,为动画设置监听事件,自定义动画的方法

    基本的动画构成共有四种:透明动画/旋转动画/移动动画/缩放动画. 配置动画的方式有两种,一种是直接使用代码来配置动画效果,另一种是使用xml文档配置动画效果 相比而言,用xml文档写出来的动画效果,写 ...

随机推荐

  1. 浅谈JavaScript DDOS 攻击原理与防御

    前言 DDoS(又名"分布式拒绝服务")攻击历史由来已久,但却被黑客广泛应用.我们可以这样定义典型的DDoS攻击:攻击者指使大量主机向服务器发送数据,直到超出处理能力进而无暇处理正 ...

  2. 神奇的Content-Type--在JSON中玩转XXE攻击

    转自:360安全播报http://bobao.360.cn/learning/detail/360.html 大家都知道,许多WEB和移动应用都依赖于Client-Server的WEB通信交互服务.而 ...

  3. CentOS7.x使用overlay文件系统

    https://www.cnblogs.com/yufeng218/p/8370670.html http://www.cnblogs.com/lehuoxiong/p/9908118.html ht ...

  4. python3之Django模型(一)

    1.模型概述 模型是关于您的数据的唯一,明确的信息来源,它包含您正在存储的数据的重要字段和行为.通常,每个模型映射到单个数据库表. 每个模型都是一个子类的python类django.db.models ...

  5. 我现所认知的SSH

    实习了三个月,对着SSH有着一定的认识了,就以自已认识的大概思路写一篇文章吧,留给以后的自已,也恳请各位博友们如果看到我的认识有过错的地方能帮我指正过来! 我用到的资料 在写正文之前,先说说我这段时间 ...

  6. faker php测试数据库生成

    官方地址:https://github.com/fzaninotto/Faker 使用方式: 1.composer直接下载: composer require fzaninotto/faker 2.将 ...

  7. ZJOI2019day1退役记

    ZJOI2019day1退役记 每天都在划水,考场上心态炸了,也没什么好说的. 有人催我更退役记,等成绩出来了再更更吧,成绩出来也没心情更了,落差好大,还打不过文化课选手 虽然被卡常数卡到心态爆炸,但 ...

  8. BZOJ.1923.[SDOI2010]外星千足虫(高斯消元 异或方程组 bitset)

    题目链接 m个方程,n个未知量,求解异或方程组. 复杂度比较高,需要借助bitset压位. 感觉自己以前写的(异或)高斯消元是假的..而且黄学长的写法都不需要回代. //1100kb 324ms #i ...

  9. 2010-2011 ACM-ICPC, NEERC, Moscow Subregional Contest Problem H. Hometask 水题

    Problem H. Hometask 题目连接: http://codeforces.com/gym/100714 Description Kolya is still trying to pass ...

  10. logstash grok 分割匹配日志

    使用logstash的时候,为了更细致的切割日志,会写一些正则表达式. 使用方法 input { file { type => "billin" path => &qu ...