POP的Stroke动画
POP的Stroke动画

效果


源码
https://github.com/YouXianMing/Animations
//
// PopStrokeController.m
// Animations
//
// Created by YouXianMing on 15/11/17.
// Copyright © 2015年 YouXianMing. All rights reserved.
// #import "PopStrokeController.h"
#import "GCD.h"
#import "POP.h"
#import "StrokeCircleLayerConfigure.h" @interface PopStrokeController () @property (nonatomic, strong) CAShapeLayer *circleShape;
@property (nonatomic, strong) GCDTimer *timer; @end @implementation PopStrokeController - (void)viewDidLoad { [super viewDidLoad];
} - (void)setup { [super setup]; self.circleShape = [CAShapeLayer layer];
self.circleShape.strokeEnd = .f;
self.circleShape.lineCap = kCALineCapRound;
StrokeCircleLayerConfigure *config = [StrokeCircleLayerConfigure new];
config.lineWidth = .f;
config.startAngle = ;
config.endAngle = M_PI * ;
config.radius = .f;
config.circleCenter = self.view.center;
config.strokeColor = [UIColor cyanColor];
[config configCAShapeLayer:self.circleShape];
[self.view.layer addSublayer:self.circleShape]; _timer = [[GCDTimer alloc] initInQueue:[GCDQueue mainQueue]]; [_timer event:^{ CGFloat value1 = arc4random() % / .f;
CGFloat value2 = arc4random() % / .f; POPSpringAnimation *strokeAnimationEnd = [POPSpringAnimation animationWithPropertyNamed:kPOPShapeLayerStrokeEnd];
strokeAnimationEnd.toValue = @(value1 > value2 ? value1 : value2);
strokeAnimationEnd.springBounciness = .f; POPSpringAnimation *strokeAnimationStart = [POPSpringAnimation animationWithPropertyNamed:kPOPShapeLayerStrokeStart];
strokeAnimationStart.toValue = @(value1 < value2 ? value1 : value2);
strokeAnimationStart.springBounciness = .f; POPBasicAnimation *strokeAnimationColor = [POPBasicAnimation animationWithPropertyNamed:kPOPShapeLayerStrokeColor];
strokeAnimationColor.toValue = (__bridge id)([self randomColor].CGColor); [self.circleShape pop_addAnimation:strokeAnimationEnd forKey:@"layerStrokeAnimation"];
[self.circleShape pop_addAnimation:strokeAnimationStart forKey:@"layerStrokeAnimation1"];
[self.circleShape pop_addAnimation:strokeAnimationColor forKey:@"layerStrokeAnimation2"]; } timeIntervalWithSecs:]; [_timer start];
} - (UIColor *)randomColor { return [UIColor colorWithRed:arc4random() % / .f
green:arc4random() % / .f
blue:arc4random() % / .f
alpha:];
} @end
细节


POP的Stroke动画的更多相关文章
- iOS_SN_push/pop转场动画封装和一般动画封装
封装类中的方法: #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface AnimationE ...
- 更改navigationController push和pop界面切换动画
For Push: MainView *nextView=[[MainView alloc] init]; [UIView beginAnimations:nil context:NULL]; [UI ...
- Swift基础之自定义PUSH和POP跳转动画
之前用OC代码写过PUSH和POP的转场动画,闲来无事,将其转换成Swift语言,希望对大家有帮助,转载请注明.... 如何实现PUSH和POP的转场动画? 首先,创建一个NSObject的类,分别用 ...
- swift -pop的简单动画
//1.新建空文件 命名Podfile //2.写入 pod ‘pop’,’~>1.0’ 保存 //3.打开终端,进入项目路径 执行pod install //4.新建桥接头文件 导入#im ...
- [翻译] POP Facebook的动画开源库
Pop is an extensible animation engine for iOS and OS X. In addition to basic static animations, it s ...
- iOS7 push/pop转场动画
前言 iOS 7之后,苹果提供了自定义转场动画的API,我们可以自己去定义任意动画效果.本篇为笔者学习push.pop自定义转场效果的笔记,如何有任何不正确或者有指导意见的,请在评论中留下您的宝贵意见 ...
- 贝塞尔曲线 & CAShapeLayer & Stroke 动画 浅谈
转载自:http://46aae4d1e2371e4aa769798941cef698.devproxy.yunshipei.com/qiaoqiaoqiao2014/article/details/ ...
- 贝塞尔曲线与CAShapeLayer的关系以及Stroke动画
1.贝塞尔曲线与CAShapeLayer的关系 1.1CAShapeLayer须要一个形状才干生效,贝塞尔曲线能够创建基于矢量的路径.进而能够给CAShapeLayer提供路径,路径会闭环. ...
- POP动画[1]
POP动画[1] pop动画是facebook扩展CoreAnimation的,使用及其方便:) 1:Spring系列的弹簧效果(两个动画kPOPLayerBounds与kPOPLayerCorner ...
随机推荐
- InterSystems Ensemble学习笔记(一) Ensemble介绍及安装
系列目录 InterSystems Ensemble学习笔记(一) Ensemble介绍及安装InterSystems Ensemble学习笔记(二) Ensemble创建镜像, 实现自动故障转移 一 ...
- Iterator 迭代器
意图 提供一种方法顺序访问一个聚合对象中各个元素 , 而又不需暴露该对象的内部表示. 动机 一个聚合对象, 如列表(list), 应该提供一种方法来让别人可以访问它的元素,而又不需暴露它的内部结构 迭 ...
- 【ARC066】F - Contest with Drinks Hard
题解 我写的斜率维护,放弃了我最擅长的叉积维护,然后发现叉积维护也不会爆long long哦-- 一写斜率维护我的代码就会莫名变长而且难写--行吧 我们看这题 推了推式子,发现这是个斜率的式子,但是斜 ...
- Codeforces Round #239 (Div. 1) 二项式差分
C - Curious Array 思路:对于区间[l, r]每个数加上C(i - l + k, k), 可以在l处+1, 在r+1处-1, 然后做k+1次求前缀和操作,然后就可以写啦. 然后逐层求前 ...
- Spring Boot 实用MyBatis做数据库操作
前言: 本项目基于maven构建,使用mybatis-spring-boot作为spring-boot项目的持久层框架 spring-boot中使用mybatis持久层框架与原spring项目使用方式 ...
- CentOS7多实例安装mysq5.6二进制版本
1丶下载mysql,解压,创建用户,创建软链接 test -d /tools || mkdir /tools ;cd /tools wget http://mirrors.sohu.com/mysql ...
- 黑马程序员_java基础笔记(02)...java语言基础组成
—————————— ASP.Net+Android+IOS开发..Net培训.期待与您交流!—————————— java语法(1:关键字,2:标识符,3:注释,4:常量和变量,5:运算符,6:语 ...
- 8-1 binpacking uva1149(贪心)
题意:给定N个物品的重量Li 背包的容量M 同时要求每个背包最多装两个物品 求至少要多少个背包才能装下所有物品 简单贪心 注意输出: #include<bits/stdc++.h> u ...
- HDU - 1027 Ignatius and the Princess II 全排列
Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ( ...
- python面向对象中类对象、实例对象、类变量、实例变量、类方法、实例方法、静态方法
1. 类对象和实例对象 Python中一切皆对象,Python类本身也是一种对象,类定义完成后,会在当前作用域中定义一个以类名为名字的命名空间.类对象具有以下两种操作: 可以通过“类名()”的方式实例 ...