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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -