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 ...
随机推荐
- 宝塔Linux常用命令
https://www.bt.cn/bbs/thread-1186-1-1.html 2017年3月8日发布全新架构的宝塔Linux 面板3.1Beta版,到现在的5.2.0正式版,历经100多天打磨 ...
- 使用celery时要注意的任务调用形式
因为之前,一直用django和celery紧密集成,不分家. 所以使用时参考了网上的配置之后,没有变更过. 最近,和洪军想用k8s的pod重新规划系统构架时,这个问题才又浮了出来. 只是我们的task ...
- OnClickListener接口
package com.example.wang.testapp2; import android.support.v7.app.AppCompatActivity; import android.o ...
- Azkaban(三)Azkaban的使用
界面介绍 首页有四个菜单 projects:最重要的部分,创建一个工程,所有flows将在工程中运行. scheduling:显示定时任务 executing:显示当前运行的任务 history:显示 ...
- Java_集合与泛型
Collection 集合,集合是java中提供的一种容器,可以用来存储多个数据.在前面的学习中,我们知道数据多了,可以使用数组存放或者使用ArrayList集合进行存放数据.那么,集合和数组既然都是 ...
- 使用IDEA运行Eclipse编辑jetty运行的J2EE项目的惨痛教训
公司的项目原本是使用Eclipse,使用自带的jetty运行, 用IDEA通过git clone后,使用Tomcat运行,可以运行,却无法访问页面,总是报错404 后来使用IDEA Jetty运行,经 ...
- Servlet中保存的cookie值读取不到
在设计登录时记住密码功能时,很多时候回使用cookie,在Servlet中保存cookie时,再次访问登录页面,没有读取到保存的cookie值,代码如下: 1 Cookie idCookie = ne ...
- OSI、TCP、IP、UDP 这些都是啥??
一个大大的问号首先抛出,计算机之间是如何进行通信的? 计算机网络是通过传输介质.通信设施和网络通信协议,把分散在不同地点的计算机设备互连起来,实现资源共享和数据传输的系统. 网络协议就是数据按照一定的 ...
- 【基础知识】winfrom窗体的属性
窗体的属性: Icon:窗体的右上角图标 FormBoarderStyle:窗体的边线样式 MaximizeBox: 最大化按钮是否可用 MinimizeBox:最小化按钮是否可用 Opacity:透 ...
- [ 原创 ]学习笔记-Android 学习笔记 Contacts (一)ContentResolver query 参数详解 [转载]
此博文转载自:http://blog.csdn.net/wssiqi/article/details/8132603 1.获取联系人姓名 一个简单的例子,这个函数获取设备上所有的联系人ID和联系人NA ...