zoukankan      html  css  js  c++  java
  • [翻译] JTSlideShadowAnimation

    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(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
  • 相关阅读:
    Java之事件处理
    Java之图形程序设计
    小议设置path环境变量
    关于JAVA中的编译和解释执行
    并发工具类 CountDownLatch
    线程池
    Properties的小问题
    转换流
    TCP中客户端和服务器的理解
    leetcode_160. 相交链表
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/4186292.html
Copyright © 2011-2022 走看看