iphone - Rotation to a specific angle not working -
i have image of cartoon face rotate shaking head little bit left right (as when hearing music) specific duration of time 5-7 seconds. so, doing following:
-(void)rotation{ cabasicanimation *rotate = [cabasicanimation animationwithkeypath:@"transform.rotation.z"]; [rotate setfromvalue:[nsnumber numberwithfloat:0.0]]; [rotate settovalue:[nsnumber numberwithfloat:45]]; [rotate setduration:5.0]; [rotate setautoreverses:yes]; [rotate settimingfunction:[camediatimingfunction functionwithname: kcamediatimingfunctioneaseineaseout]]; [[faceimage layer] addanimation:rotate forkey:@"danglefaceimage"]; }
but image spinning ball! think code not correct @ all. how can rotation?
you have work on setting anchor point of layer. place anchor point of layer containing face @ lower mid bottom. rotation take place point. appear head tilting neck.
Comments
Post a Comment