6

I would like to change rect with bezier path movement:

CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = [self createArcPath].CGPath;
shapeLayer.strokeColor = [[UIColor blueColor] CGColor];
shapeLayer.lineWidth = 1.0;
shapeLayer.fillColor = [[UIColor clearColor] CGColor];
[self.view.layer addSublayer:shapeLayer];

UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];

// btn.frame = CGRectMake(326, 174, 64, 64);
[btn setBackgroundImage:[UIImage imageNamed:@"Volleyball_Ball.png" forState:UIControlStateNormal];
[self.view addSubview:btn];

// car = [CALayer layer];
// car.frame = CGRectMake(326, 174, 48, 48);
// car.contents = (id)([UIImage imageNamed:@"1453303583_circle_blue.png"].CGImage);
// [self.view.layer addSublayer:car];

CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
anim.path = [self createArcPath].CGPath;
anim.rotationMode = kCAAnimationRotateAuto;
anim.delegate = self;
anim.repeatCount = 1;
anim.duration = 3.0;
[btn.layer addAnimation:anim forKey:@"race"];
btn.frame = CGRectMake(20, 174, 64, 64);

I would like to get CGRECT for every point during movement and store into and array, Its already moving in a circle but I need to get CGRECT for every Point.

Saad Chaudhry
  • 1,392
  • 23
  • 37
Matloob Hasnain
  • 1,025
  • 6
  • 21

0 Answers0