ios - Spinning an image around like a coin -
i have 1 image. want spin coin spin on surface. tried rotation transform not spin that. how achieve such animation?
code:
- (void)viewdidload { [super viewdidload]; [self.view setuserinteractionenabled:yes]; lbl_facebook.font=[uifont fontwithname:gzfont size:12.0f]; txtpassword.font=[uifont fontwithname:gzfont size:15.0f]; txtusername.font=[uifont fontwithname:gzfont size:15.0f]; catransition* transition = [catransition animation]; transition.startprogress = 0; transition.endprogress = 1.0; transition.type = @"flip"; transition.subtype = @"fromright"; transition.duration = 0.3; transition.repeatcount = 2; [_image.layer addanimation:transition forkey:@"transition"];
}
nd:
#import "loginviewcontroller.h" #import "registrationviewcontroller.h" #import "forgetpasswordviewcontroller.h" #import "forgetpasswordcontroller.h" #import "searchserviceproviderviewcontroller.h" #import <quartzcore/quartzcore.h>
this make nice, coin-like flip:
catransition* transition = [catransition animation]; transition.startprogress = 0; transition.endprogress = 1.0; transition.type = @"flip"; transition.subtype = @"fromright"; transition.duration = 0.3; transition.repeatcount = 2;
and add transition animation layer of view:
[_yourview.layer addanimation:transition forkey:@"transition"];
see in action:
Comments
Post a Comment