美文网首页Core Animation
CoreAnimation----CAReplicatorLay

CoreAnimation----CAReplicatorLay

作者: M_PI_4 | 来源:发表于2018-04-19 15:43 被阅读0次
- (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----CAReplicatorLay

    本文链接:https://www.haomeiwen.com/subject/uhnckftx.html