ios - CAKeyframeAnimation repeat animation from begin to end -
i need add infinite animation uiimageview start point end point , after end point start point. trying this:
cakeyframeanimation *pathanimation = [cakeyframeanimation animationwithkeypath:@"position"]; pathanimation.calculationmode = kcaanimationpaced; pathanimation.fillmode = kcafillmodeforwards; pathanimation.removedoncompletion = no; pathanimation.duration = 2.0; pathanimation.repeatcount = huge_valf; pathanimation.timingfunction = [camediatimingfunction functionwithname:kcamediatimingfunctioneaseineaseout]; cgpoint endpoint = cgpointmake(320.0f - 30.0f, self.myimage.frame.size.height); cgmutablepathref curvedpath = cgpathcreatemutable(); cgpathmovetopoint(curvedpath, null, self.myimage.frame.origin.x, self.myimage.frame.origin.y); cgpathaddcurvetopoint(curvedpath, null, endpoint.x, self.myimage.frame.origin.y, endpoint.x, self.myimage.frame.origin.y, endpoint.x, endpoint.y); pathanimation.path = curvedpath; cgpathrelease(curvedpath); [self.myimage.layer addanimation:pathanimation forkey:@"curveanimation"]; myimage moves start point end ok, after move start point , repeat animation start point end. so, there no animation end point start. possible do?
animating same way came simple setting autoreverses yes.
that said, if it's infinite animation don't need fillmode or removedoncompletion
Comments
Post a Comment