美文网首页iOS动画技术
常见的加载动画(loading...)

常见的加载动画(loading...)

作者: 0诛仙0 | 来源:发表于2016-06-24 16:01 被阅读357次

CAReplicatorLayer * repLlayer = [CAReplicatorLayer layer];//复制层layer

repLlayer.frame = _LoadView.bounds;

repLlayer.backgroundColor = [UIColor blackColor].CGColor;

[_LoadView.layer addSublayer:repLlayer];

CALayer * layer = [CALayer layer];

layer.frame = CGRectMake(0, 0, 10, 10);

layer.transform = CATransform3DMakeScale(0, 0, 0);

layer.anchorPoint = CGPointMake(0.5, 1);

layer.position = CGPointMake(_LoadView.frame.size.width/2, 10);

layer.cornerRadius = 5 ;

layer.backgroundColor = [UIColor greenColor].CGColor;

[repLlayer addSublayer:layer];

repLlayer.instanceCount = 20 ;

repLlayer.instanceDelay = 2.0/20;

//    repLlayer.repeatDuration = 2.0/20;

repLlayer.instanceTransform = CATransform3DMakeRotation(M_PI *2/20, 0, 0, 1);

CABasicAnimation * baseAni = [[CABasicAnimation alloc]init];

baseAni.keyPath = @"transform.scale";

baseAni.fromValue = @1;

baseAni.toValue = @0;

baseAni.duration = 2;

baseAni.repeatCount = MAXFLOAT ;

[layer addAnimation:baseAni forKey:nil];

相关文章

网友评论

    本文标题:常见的加载动画(loading...)

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