CoreAnimation----CAReplicatorLayer

- (void)viewDidLoad {
    [super viewDidLoad];
    
    CAReplicatorLayer *replicator = [CAReplicatorLayer layer];
    replicator.frame = self.clipView.bounds;
    [self.clipView.layer addSublayer:replicator];
    
    replicator.instanceCount = 10;      //图层重复次数
    
    CATransform3D trnsform = CATransform3DIdentity;
    trnsform = CATransform3DTranslate(trnsform, 0, 200, 0);
    trnsform = CATransform3DRotate(trnsform, M_PI / 5.0, 0, 0, 1);
    trnsform = CATransform3DTranslate(trnsform, 0, -200, 0);
    replicator.instanceTransform = trnsform;
    
    replicator.instanceBlueOffset = -0.1;
    replicator.instanceGreenOffset = -0.1;
    
    CALayer *layer = [CALayer layer];
    layer.frame = CGRectMake(100.0f, 100.0f, 100.0f, 100.0f);
    layer.backgroundColor = [UIColor whiteColor].CGColor;
    [replicator addSublayer:layer];
}

你可能感兴趣的:(CoreAnimation----CAReplicatorLayer)