ios - Running multiple CAKeyframeAnimations at the same time -
so have 2 cakeyframeanimations on different layers , want them run simultaneously.
previously tried running them using dispatch_async. didn't worked , animation still running in sequence.
after bit of search found must utilize catransaction run animations simultaneously. still running in sequence.what doing wrong here.
[catransaction begin]; self.btn1.frame = bezierpathpoint; cakeyframeanimation* keyframeanimation = [cakeyframeanimation animationwithkeypath:@"position"]; keyframeanimation.duration = 1.5; keyframeanimation.path = [bezierpath cgpath]; keyframeanimation.timingfunction = [camediatimingfunction functionwithname:kcamediatimingfunctioneaseout]; [self.btn1.layer addanimation:keyframeanimation forkey:@"position"]; self.btn3.frame = bezierpathpoint2; cakeyframeanimation* keyframeanimation2 = [cakeyframeanimation animationwithkeypath:@"position"]; keyframeanimation.duration = 1.5; keyframeanimation.path = [bezierpath cgpath]; keyframeanimation.timingfunction = [camediatimingfunction functionwithname:kcamediatimingfunctioneaseout]; [self.btn3.layer addanimation:keyframeanimation2 forkey:@"position"]; [catransaction commit];
ios objective-c core-animation cakeyframeanimation catransaction
No comments:
Post a Comment