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. 【Kafka】Consumer配置

    从0.9.0.0开始,下面是消费者的配置. 名称 描述 类型 默认值 bootstrap.servers 消费者初始连接kafka集群时的地址列表.不管这边配置的什么地址,消费者会使用所有的kafka ...

  2. JAVA list对象排序加去重问题

    对象类实现继承Comparable接口重写compareTo方法实现排序功能,重写equals方法实现去重功能(根据ID去重)public class TestAbilityAnalyze imple ...

  3. Angular 应用中的登陆与身份验证

    Angular 经常会被用到后台和管理工具的开发,这两类都会需要对用户进行鉴权.而鉴权的第一步,就是进行身份验证.由于 Angular 是单页应用,会在一开始,就把大部分的资源加载到浏览器中,所以就更 ...

  4. C# SocketUdpServer

    public interface ISocketUdpServer { void Start(); void Stop(); int SendData(byte[] data, IPEndPoint ...

  5. 经典实用的iptables shell脚本

    先解释一下iptables里的参数意思:A: 添加 (跟链)-I: 插入-p: 跟协议-s: 源IP-d: 目标IP-j: 操作行为-t: 加表--to-source:SNAT用,表示改成的SNAT源 ...

  6. GroupBox 分组框控件

    GroupBox 控件是由System.Windows.Forms.GroupBox类提供的,作用是为其他控件提供可识别的分组.   可在同一页面,实现多个单选的RadioButton   通常,使用 ...

  7. Knockout.js hasFocus

    <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8&quo ...

  8. WCF 之部署(VS2010)

    一. 环境vs2010,WCF应用程序,server 2008 第一步:WCF项目右键点击项目,选择生成部署包,如下图: 第二步:WCF项目上右键,选择:在windows资源管理器中打开文件夹,如下图 ...

  9. golang爬取免费代理IP

    golang爬取免费的代理IP,并验证代理IP是否可用 这里选择爬取西刺的免费代理Ip,并且只爬取了一页,爬取的时候不设置useAgent西刺不会给你数据,西刺也做反爬虫处理了,所以小心你的IP被封掉 ...

  10. async和await理解代码

    <1>:Async和Await的理解1 using System; using System.Collections.Generic; using System.Linq; using S ...