zoukankan      html  css  js  c++  java
  • 用UIInterpolatingMotionEffect产生透视效果

    用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

    细节

  • 相关阅读:
    Alpha 冲刺 (8/10)
    Alpha 冲刺 (7/10)
    Alpha 冲刺 (6/10)
    团队作业-随堂小测(同学录)
    Alpha 冲刺 (5/10)
    LeetCode-1
    c++向量
    软件工程实践总结作业
    个人作业——软件产品案例分析
    个人技术博客Alpha----Android Studio学习
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/5204515.html
Copyright © 2011-2022 走看看