Skip to content

Commit

Permalink
余额宝数字跳动
Browse files Browse the repository at this point in the history
新增余额宝数字跳动
  • Loading branch information
BigShow1949 committed Aug 20, 2016
1 parent bedbe64 commit 922e6e7
Show file tree
Hide file tree
Showing 13 changed files with 375 additions and 4 deletions.
Binary file modified .svn/wc.db
Binary file not shown.
40 changes: 40 additions & 0 deletions BigShow1949.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
184B384A1D252060005CD7F1 /* UITableViewCell+YFDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 184B38491D252060005CD7F1 /* UITableViewCell+YFDataSource.m */; };
184B384D1D252175005CD7F1 /* ModelTwo.m in Sources */ = {isa = PBXBuildFile; fileRef = 184B384C1D252175005CD7F1 /* ModelTwo.m */; };
184B38531D2521A8005CD7F1 /* ModelOne.m in Sources */ = {isa = PBXBuildFile; fileRef = 184B38521D2521A8005CD7F1 /* ModelOne.m */; };
185C98AC1D67E6EC00955C5F /* UILabel+BezierAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 185C98A71D67E6EC00955C5F /* UILabel+BezierAnimation.m */; };
185C98AD1D67E6EC00955C5F /* WSBezier.m in Sources */ = {isa = PBXBuildFile; fileRef = 185C98A91D67E6EC00955C5F /* WSBezier.m */; };
185C98AE1D67E6EC00955C5F /* YFAliNumberViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 185C98AB1D67E6EC00955C5F /* YFAliNumberViewController.m */; };
185C98B21D67E83800955C5F /* YFAliViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 185C98B11D67E83800955C5F /* YFAliViewController.m */; };
189242651B99D065008AC1EB /* YFAboutUsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 189242641B99D065008AC1EB /* YFAboutUsViewController.m */; };
18C2D5331BAEDC98006CD3B2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18C2D5311BAEDC61006CD3B2 /* UIKit.framework */; };
18C2D5361BAEDCC8006CD3B2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18C2D5341BAEDCAC006CD3B2 /* Foundation.framework */; };
Expand Down Expand Up @@ -580,6 +584,14 @@
184B384C1D252175005CD7F1 /* ModelTwo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ModelTwo.m; sourceTree = "<group>"; };
184B38511D2521A8005CD7F1 /* ModelOne.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModelOne.h; sourceTree = "<group>"; };
184B38521D2521A8005CD7F1 /* ModelOne.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ModelOne.m; sourceTree = "<group>"; };
185C98A61D67E6EC00955C5F /* UILabel+BezierAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+BezierAnimation.h"; sourceTree = "<group>"; };
185C98A71D67E6EC00955C5F /* UILabel+BezierAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+BezierAnimation.m"; sourceTree = "<group>"; };
185C98A81D67E6EC00955C5F /* WSBezier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WSBezier.h; sourceTree = "<group>"; };
185C98A91D67E6EC00955C5F /* WSBezier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WSBezier.m; sourceTree = "<group>"; };
185C98AA1D67E6EC00955C5F /* YFAliNumberViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YFAliNumberViewController.h; sourceTree = "<group>"; };
185C98AB1D67E6EC00955C5F /* YFAliNumberViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YFAliNumberViewController.m; sourceTree = "<group>"; };
185C98B01D67E83800955C5F /* YFAliViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YFAliViewController.h; sourceTree = "<group>"; };
185C98B11D67E83800955C5F /* YFAliViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YFAliViewController.m; sourceTree = "<group>"; };
189242631B99D065008AC1EB /* YFAboutUsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YFAboutUsViewController.h; sourceTree = "<group>"; };
189242641B99D065008AC1EB /* YFAboutUsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YFAboutUsViewController.m; sourceTree = "<group>"; };
18C2D5311BAEDC61006CD3B2 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -1596,6 +1608,28 @@
path = MyDataSource;
sourceTree = "<group>";
};
185C98A51D67E6EC00955C5F /* 仿支付宝余额跳动 */ = {
isa = PBXGroup;
children = (
185C98A61D67E6EC00955C5F /* UILabel+BezierAnimation.h */,
185C98A71D67E6EC00955C5F /* UILabel+BezierAnimation.m */,
185C98A81D67E6EC00955C5F /* WSBezier.h */,
185C98A91D67E6EC00955C5F /* WSBezier.m */,
185C98AA1D67E6EC00955C5F /* YFAliNumberViewController.h */,
185C98AB1D67E6EC00955C5F /* YFAliNumberViewController.m */,
);
path = "仿支付宝余额跳动";
sourceTree = "<group>";
};
185C98AF1D67E82500955C5F /* 阿里巴巴 */ = {
isa = PBXGroup;
children = (
185C98B01D67E83800955C5F /* YFAliViewController.h */,
185C98B11D67E83800955C5F /* YFAliViewController.m */,
);
path = "阿里巴巴";
sourceTree = "<group>";
};
18C2D52F1BAEDC2C006CD3B2 /* Framework */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2358,6 +2392,7 @@
children = (
8BC4ADC81B9688750026B012 /* YFImitateAppViewController.h */,
8BC4ADC91B9688750026B012 /* YFImitateAppViewController.m */,
185C98AF1D67E82500955C5F /* 阿里巴巴 */,
B870424B1CAB7B370067653C /* 猿题库 */,
B852D57D1C52329300454E7F /* 微信 */,
B852D5661C5224BC00454E7F /* 网易 */,
Expand Down Expand Up @@ -3072,6 +3107,7 @@
children = (
B87300811C50742800090C9D /* YFBezierViewController.h */,
B87300821C50742800090C9D /* YFBezierViewController.m */,
185C98A51D67E6EC00955C5F /* 仿支付宝余额跳动 */,
B87300881C50807200090C9D /* 02 - 渐变色 */,
B87300841C5075BD00090C9D /* 01 - 动态圆圈 */,
);
Expand Down Expand Up @@ -4275,6 +4311,7 @@
B83336721CD89487003B347A /* MenuItemCell.m in Sources */,
8BC4AD901B9682B00026B012 /* MJRefreshHeaderView.m in Sources */,
B88A15511CA393F400BFC377 /* Case7ViewController.m in Sources */,
185C98AC1D67E6EC00955C5F /* UILabel+BezierAnimation.m in Sources */,
8BC4AD4C1B9681B70026B012 /* SDWebImageDownloaderOperation.m in Sources */,
181F28B11D2CF53C00FC2637 /* YFPerson+addproty.m in Sources */,
B891D9F51CA0F7A9007F69AF /* RZZoomPushAnimationController.m in Sources */,
Expand Down Expand Up @@ -4325,6 +4362,7 @@
18C760DB1B9ACC960038B2EE /* SYTabButton.m in Sources */,
B88A15521CA393F400BFC377 /* Case8Cell.m in Sources */,
B891DB3C1CA13C46007F69AF /* NSObject+KVC.m in Sources */,
185C98AD1D67E6EC00955C5F /* WSBezier.m in Sources */,
B891DB291CA1300D007F69AF /* ZYQSphereView.m in Sources */,
B88A154E1CA393F400BFC377 /* Case5ViewController.m in Sources */,
18CAD0841B9977E3001066FF /* YFPopOutMenu.m in Sources */,
Expand Down Expand Up @@ -4392,6 +4430,7 @@
B893865F1C9FCE6300B122B8 /* HHContentScrollView.m in Sources */,
B891D9F71CA0F7A9007F69AF /* UIImage+RZTransitionsSnapshotHelpers.m in Sources */,
B8E9EFF91CEAF00C00E7E668 /* YFNetworkRequestViewController.m in Sources */,
185C98AE1D67E6EC00955C5F /* YFAliNumberViewController.m in Sources */,
B84C03361CE317DE00E62D75 /* ITRSecondViewController.m in Sources */,
18CAD07A1B9977E3001066FF /* YFItemView.m in Sources */,
B83EA95C1CC0C74C00807828 /* FMDatabasePool.m in Sources */,
Expand Down Expand Up @@ -4535,6 +4574,7 @@
18CAD07F1B9977E3001066FF /* YFAnimationVC03.m in Sources */,
8BC4AD8B1B9682B00026B012 /* NSObject+MJMember.m in Sources */,
B864C7961C99322F00D1E440 /* WSFSlideTitlesView.m in Sources */,
185C98B21D67E83800955C5F /* YFAliViewController.m in Sources */,
B8E9F0331CEAF11E00E7E668 /* AFURLSessionManager.m in Sources */,
B891DB161CA12E65007F69AF /* LazyFadeInLayer.m in Sources */,
8B0B9ADE1B9572510084590D /* AppDelegate.m in Sources */,
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ - (void)viewDidLoad {
[super viewDidLoad];

self.titles = @[@"动态圆圈",
@"渐变色"];
@"渐变色",
@"仿支付宝余额跳动"];

self.classNames = @[@"YFCircleViewController",
@"YFGradientViewController"];
@"YFGradientViewController",
@"YFAliNumberViewController"];
}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// UILabel+BezierAnimation.h
// Test
//
// Created by senro wang on 15/8/11.
// Copyright (c) 2015年 王燊. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UILabel (BezierAnimation)

//label 上的数字 从某一个值变化到 另一个值 - (动画) -

- (void)animationFromnum:(float )fromNum toNum:(float )toNum duration:(float )duration;


@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
//
// UILabel+BezierAnimation.m
// Test
//
// Created by senro wang on 15/8/11.
// Copyright (c) 2015年 王燊. All rights reserved.
//

#import "UILabel+BezierAnimation.h"
#import "WSBezier.h"

#define KMaxTimes 100


@implementation UILabel (BezierAnimation)

NSMutableArray *totlePoints; //纪录所有的点。

WSBezier *bezier; //通过 改变bezier 函数的参数 (也就是 四个 控制点)可以改变动画的样式 -

float _duration; // 动画 间隔
float _fromNum;
float _toNum;

float _lastTime; //纪录每一个点的 时刻

int _index;


//- (instancetype)initWithFrame:(CGRect)frame{
//
// if (self = [super initWithFrame:frame]) {
//
//// [self _initBezier];
//// [self _cleanVars];
// }
//
// return self;
//}

- (void)_cleanVars{

_lastTime = 0;
_index = 0;
// self.text = @"0";

}


//初始化 控制点
- (void)_initBezier{


bezier = [[WSBezier alloc] init];
}


- (void)animationFromnum:(float)fromNum toNum:(float)toNum duration:(float)duration{

[self _cleanVars];
[self _initBezier];

_duration = duration;
_fromNum = fromNum;
_toNum = toNum;


totlePoints = [NSMutableArray array];
float dt = 1.0 / (KMaxTimes - 1);
for (NSInteger i = 0; i < KMaxTimes; i ++ ) {

WSPoint point = [bezier pointWithdt:dt * i];


float currTime = point.x * _duration;
float currValue = point.y * (_toNum - _fromNum) + _fromNum;

NSArray *array = [NSArray arrayWithObjects:[NSNumber numberWithFloat:currTime] , [NSNumber numberWithFloat:currValue], nil];
[totlePoints addObject:array];

}

[self changeNumberBySelector];

}

- (void)changeNumberBySelector {
if (_index>= KMaxTimes) {
self.text = [NSString stringWithFormat:@"%.0f",_toNum]; return;
} else {
NSArray *pointValues = [totlePoints objectAtIndex:_index];
_index++;
float value = [(NSNumber *)[pointValues objectAtIndex:1] intValue];
float currentTime = [(NSNumber *)[pointValues objectAtIndex:0] floatValue];
float timeDuration = currentTime - _lastTime;
_lastTime = currentTime;
self.text = [NSString stringWithFormat:@"%.0f",value];
[self performSelector:@selector(changeNumberBySelector) withObject:nil afterDelay:timeDuration];
}
}




@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// WSBezier.h
// Test
//
// Created by senro wang on 15/8/11.
// Copyright (c) 2015年 王燊. All rights reserved.
//

#import <Foundation/Foundation.h>


typedef struct
{
float x;
float y;
} WSPoint;


@interface WSBezier : NSObject

@property (nonatomic,assign) WSPoint wsStart;
@property (nonatomic,assign) WSPoint wsFirst;
@property (nonatomic,assign) WSPoint wsSecond;
@property (nonatomic,assign) WSPoint wsEnd;


- (WSPoint )pointWithdt:(float )dt;


@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//
// WSBezier.m
// Test
//
// Created by senro wang on 15/8/11.
// Copyright (c) 2015年 王燊. All rights reserved.
//

#import "WSBezier.h"

@implementation WSBezier


- (instancetype)init{

if (self = [super init]) {


[self _initPoints];
}
return self;
}

- (void)_initPoints{

WSPoint start;
WSPoint first;
WSPoint second;
WSPoint end;
start.x = 0;
start.y = 0;
first.x = 0;
first.y = 0.57;
second.x = 0.44;
second.y = 1;
end.x = 1;
end.y = 1;

self.wsStart = start;
self.wsFirst = first;
self.wsSecond = second;
self.wsEnd = end;

}


//贝塞尔 -
//y=y0·(1-t)³+3·y1·t·(1-t)²+3·y2·t²·(1-t)+y3·t³
//x=x0·(1-t)³+3·x1·t·(1-t)²+3·x2·t²·(1-t)+x3·t³


//贝塞尔的 四个 控制点
//(0 , 0 ) (0 , 0.57) (0.44 , 1 ) (1 ,1); //
// 还可以 设置 ease in , ease out ,ease inout ,以及spring动画 。 有需要 联系[email protected]


//推荐大家一个网站 - 在这里你可以随意diy 你的 动画曲线 -
//http://labs.pufen.net/cubic-bezier/#0,.57,.44,1


- (WSPoint)pointWithdt:(float )dt{

WSPoint result;

float t = 1 - dt;
float tSqure = t * t;
float tCube = t * tSqure;
float dtSqure = dt * dt;
float dtCube = dtSqure * dt;

result.x = self.wsStart.x * tCube + 3 * self.wsFirst.x * dt * tSqure + 3 * self.wsSecond.x * dtSqure * t + self.wsEnd.x * dtCube;
result.y = self.wsStart.y * tCube + 3 * self.wsFirst.y * dt * tSqure + 3 * self.wsSecond.y * dtSqure * t + self.wsEnd.y * dtCube;
return result;


}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// YFAliNumberViewController.h
// BigShow1949
//
// Created by apple on 16/8/19.
// Copyright © 2016年 BigShowCompany. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface YFAliNumberViewController : UIViewController

@end
Loading

0 comments on commit 922e6e7

Please sign in to comment.