JTSlideShadowAnimation

效果图:

JTSlideShadowAnimation allow you to reproduce the famous "slide to unlock effect" on iOS.

JTSlideShadowAnimation能让你重现巨好看的“锁屏滑动辉光”效果

Usage - 使用

Basic 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];
}

Customization - 定制

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];
}

Requirements - 需要的环境

  • iOS 7 or higher iOS7或者更高版本
  • Automatic Reference Counting (ARC) ARC

Known Issues - 已知的问题

  • Animation stop when the application go in background, you have to restart it manually 程序进入后台然后进入前台时,动画会被移除,需要你手动重新开启

Author - 作者

License - 声明

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(, , , )];
self.animatedView.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Thin"
size:.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

[翻译] JTSlideShadowAnimation的更多相关文章

  1. 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...

  2. 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...

  3. [翻译]开发文档:android Bitmap的高效使用

    内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...

  4. 【探索】机器指令翻译成 JavaScript

    前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...

  5. 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...

  6. 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...

  7. 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...

  8. 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?

    0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...

  9. ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点

    在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...

随机推荐

  1. Js 中的false,零值,null,undefined和空字符串对象

    转自  http://www.imkevinyang.com/2009/07/javascript-中的false零值nullundefined和空字符串对象.html 在Javascript中,我们 ...

  2. AngularJS 的常用特性(三)

    6.表达式  在模板中使用表达式是为了以充分的灵活性在模板.业务逻辑和数据之间建立联系,同时又能避免让业务逻辑渗透到模板中. <div ng-controller="SomeContr ...

  3. jQueryEasyUI 学习笔记

    jQuery EasyUI是什么? jQuery EasyUI是一组基于jQuery的UI插件集合体,而jQuery EasyUI的目标就是帮助web开发者更轻松的打造出功能丰富并且美观的UI界面.开 ...

  4. Sumblime Text 2/3 插件安装方法

    使用Package Control组件安装 按Ctrl+`调出console(注:安装有QQ输入法的这个快捷键会有冲突的,输入法属性设置-输入法管理-取消热键切换至QQ拼音): 如果是sublime ...

  5. 搭建Web部署环境

    这里使用Web轻量级的服务器Tomcat Tomcat常用作servlet的运行容器,在JavaWeb开发中广泛使用,当然,Tomcat也可为提供HTML页面服务. 主要步骤: Tomcat下载安装 ...

  6. Git建立独立分支

    前言 在码云建立git项目后默认分支是master, 这里如果直接在码云新建分支, 会指定默认分支; 所以通过git 命令git checkout --orphan 新分支名 创建独立分支 创建 创建 ...

  7. C#操作xml文件:使用XmlDocument 实现读取和写入

    XML文件是一种常用的文件格式,例如WinForm里面的app.config以及Web程序中的web.config文件,还有许多重要的场所都有它的身影.Xml是Internet环境中跨平台的,依赖于内 ...

  8. 认识Groovy

    什么是groovy: Groovy 是 JVM 的一个替代语言 —替代 是指可以用 Groovy 在 Java 平台上进行 Java 编程,使用方式基本与使用 Java 代码的方式相同. 在编写新应用 ...

  9. java设计模式-----5、原型模式

    原型(Prototype)模式是一种对象创建型模式,他采取复制原型对象的方法来创建对象的实例.使用原型模式创建的实例,具有与原型一样的数据. 原型模式的特点: 1.由原型对象自身创建目标对象.也就是说 ...

  10. RegExp使用技巧

    正则表达式 //用法 1. /\d/g 2. new RegExp('/\d/','g') //修饰符 g,i,m //元字符 1.元字符是在正则表达式中有特殊含义的非字母字符 . * + ? $ ^ ...