ios - CAAnimationGroup with CAKeyframeAnimation and CABasicAnimation -
i'm trying animate view along curved path , scale down @ same time:
cakeyframeanimation *pathanimation = [cakeyframeanimation animationwithkeypath:@"position"]; pathanimation.calculationmode = kcaanimationpaced; pathanimation.fillmode = kcafillmodeforwards; pathanimation.removedoncompletion = no; //setting endpoint of animation cgpoint endpoint = endcenter; cgmutablepathref curvedpath = cgpathcreatemutable(); cgpathmovetopoint(curvedpath, null, vieworigin.x, vieworigin.y); cgpathaddcurvetopoint(curvedpath, null, vieworigin.x+200, vieworigin.y-150, endpoint.x+100, endpoint.y+10, endpoint.x, endpoint.y); pathanimation.path = curvedpath; cgpathrelease(curvedpath); // set scaling cabasicanimation *resizeanimation = [cabasicanimation animationwithkeypath:@"transform.scale"]; resizeanimation.tovalue = [nsnumber numberwithdouble:0.4]; resizeanimation.fillmode = kcafillmodeforwards; resizeanimation.removedoncompletion = no; caanimationgroup *group = [caanimationgroup animation]; group.fillmode = kcafillmodeforwards; group.removedoncompletion = yes; [group setanimations:[nsarray arraywithobjects: pathanimation, resizeanimation, nil]]; group.duration = 3.7f; group.delegate = self; [group setvalue:self.myview forkey:@"imageviewbeinganimated"]; self.myview.center = endcenter; self.myview.transform = self.myviewtransform; [self.myview.layer addanimation:group forkey:@"savinganimation"];
the problem instead of view scaling down gradually moves, gets scaled down, moves along path. need to scale down moves obviously.
solved doing this:
resizeanimation.fromvalue = [nsnumber numberwithdouble:1.0];
i don't understand why have this. seems should start default fromvalue of current transform.
Comments
Post a Comment