vendredi 25 avril 2014

Animate CAReplicatorLayer along UIBezierPath


Vote count:

0




I would like to place shapes along a bezierpath using a CAReplicatorLayer. My code right now places them in a line. Does anyone know how/where to introduce a path that my replicator layer can follow?



- (void)viewDidLoad


{ [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib.



CAReplicatorLayer *xLayer = [CAReplicatorLayer layer];
xLayer.instanceCount = 11;
xLayer.instanceDelay = .2;
xLayer.instanceGreenOffset = -.03;
xLayer.instanceRedOffset = -.02;
xLayer.instanceBlueOffset = -.01;
xLayer.instanceAlphaOffset = -.05;
xLayer.preservesDepth = YES;
xLayer.instanceTransform =
CATransform3DMakeTranslation(110, 0, 200);

[self.view.layer addSublayer:xLayer];

CAShapeLayer *layer1 = [CAShapeLayer layer];
layer1.position = CGPointMake(50, 300);
layer1.bounds = CGRectMake(0, 0, 30, 30);
layer1.backgroundColor = [[UIColor yellowColor] CGColor];
layer1.cornerRadius = 10.;
layer1.shadowColor = [[UIColor blackColor] CGColor];
layer1.shadowRadius = 4.0f;
layer1.shadowOffset = CGSizeMake(0.0f, 3.0f);
layer1.shadowOpacity = .8;
layer1.opacity = 0.8;
layer1.borderColor = [[UIColor whiteColor] CGColor];
layer1.borderWidth = 2.0;

[xLayer addSublayer:layer1];


asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire