标签:
JTSlideShadowAnimation
效果图:
JTSlideShadowAnimation allow you to reproduce the famous "slide to unlock effect" on iOS.
JTSlideShadowAnimation能让你重现巨好看的“锁屏滑动辉光”效果
Usage - 使用
Just import JTSlideShadowAnimation.h
.
只要引入 JTSlideShadowAnimation.h 文件即可
#import "JTSlideShadowAnimation.h"
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIButton *animatedView;
@property (strong, nonatomic) JTSlideShadowAnimation *shadowAnimation;
@end
Assign the view you want to animate and start the animation.
给你想要的view附上值,然后执行动画
- (void)viewDidLoad
{
[super viewDidLoad];
self.shadowAnimation = [JTSlideShadowAnimation new];
self.shadowAnimation.animatedView = self.animatedView;
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self.shadowAnimation start];
}
You can easily customize the animation.
你可以简单定制以下的一些属性
shadowBackgroundColor
shadowForegroundColor
shadowWidth
repeatCount
duration
Example:
例子:
- (void)viewDidLoad
{
[super viewDidLoad];
self.shadowAnimation = [JTSlideShadowAnimation new];
self.shadowAnimation.animatedView = self.animatedView;
self.shadowAnimation.shadowBackgroundColor = [UIColor colorWithWhite:0. alpha:.3];
self.shadowAnimation.shadowForegroundColor = [UIColor blackColor];
self.shadowAnimation.shadowWidth = 40.;
self.shadowAnimation.repeatCount = 3;
self.shadowAnimation.duration = 3.;
[self.shadowAnimation start];
}
JTSlideShadowAnimation is released under the MIT license. See the LICENSE file for more info.
JTSlideShadowAnimation基于MIT协议,你可以看看协议了解更多信息。
附录源码:
// // ViewController.m // ShowAnimation // // Created by YouXianMing on 14/12/26. // Copyright (c) 2014年 YouXianMing. All rights reserved. // #import "ViewController.h" #import "JTSlideShadowAnimation.h" @interface ViewController () @property (strong, nonatomic) UIButton *animatedView; @property (strong, nonatomic) JTSlideShadowAnimation *shadowAnimation; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // 设置背景图片 UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.view.bounds]; imageView.image = [UIImage imageNamed:@"background"]; imageView.contentMode = UIViewContentModeScaleAspectFill; [self.view addSubview:imageView]; // 设置按钮 self.animatedView = [[UIButton alloc] initWithFrame:CGRectMake(0, 30, 320, 30)]; self.animatedView.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Thin" size:20.f]; [self.animatedView setTitle:@"YouXianMing NoZuoNoDie" forState:UIControlStateNormal]; [self.animatedView setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [self.view addSubview:self.animatedView]; // 设置阴影 self.shadowAnimation = [JTSlideShadowAnimation new]; self.shadowAnimation.animatedView = self.animatedView; [self.shadowAnimation start]; } @end
标签:
原文地址:http://www.cnblogs.com/YouXianMing/p/4186292.html