首页 > 其他 > 详细

用UIInterpolatingMotionEffect产生透视效果

时间:2016-02-21 11:32:57      阅读:376      评论:0      收藏:0      [点我收藏+]

用UIInterpolatingMotionEffect产生透视效果

技术分享

 

效果

技术分享

 

源码

https://github.com/YouXianMing/Animations

//
//  MotionEffectViewController.m
//  Animations
//
//  Created by YouXianMing on 16/2/18.
//  Copyright © 2016年 YouXianMing. All rights reserved.
//

#import "MotionEffectViewController.h"
#import "UIView+MotionEffect.h"
#import "UIView+SetRect.h"

@interface MotionEffectViewController ()

@end

@implementation MotionEffectViewController

- (void)setup {
    
    [super setup];
    
    {
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, Width - 15, Width - 15)];
        imageView.image        = [UIImage imageNamed:@"最外层"];
        imageView.center       = self.contentView.middlePoint;
        [self.contentView addSubview:imageView];
        
        [imageView addCenterMotionEffectsWithOffset:20.f];
    }
    
    {
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, Width - 15, Width - 15)];
        imageView.image        = [UIImage imageNamed:@"中间层"];
        imageView.center       = self.contentView.middlePoint;
        [self.contentView addSubview:imageView];
        
        [imageView addCenterMotionEffectsWithOffset:10.f];
    }
    
    {
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, Width - 15, Width - 15)];
        imageView.image        = [UIImage imageNamed:@"最里层"];
        imageView.center       = self.contentView.middlePoint;
        [self.contentView addSubview:imageView];
        
        [imageView addCenterMotionEffectsWithOffset:5.f];
    }
}

@end

 

细节

技术分享

 

用UIInterpolatingMotionEffect产生透视效果

原文:http://www.cnblogs.com/YouXianMing/p/5204515.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!