Thursday 1 October 2015

How To Work With Basic UIAnimation In Ios/Iphone

=> First take IBOutlet ofUIVIew And Take Some Samll example:

==>  like example:-

 @property (weak, nonatomic) IBOutlet UIView *redView;

=> Used on Core Animation It Used Basic Animation On UIView :
     Then Use on Button Action :

//CABasicAnimtion
    CABasicAnimation *basicAnimtion = [CABasicAnimation animationWithKeyPath:@"opacity"];
    basicAnimtion.fromValue = [NSNumber numberWithFloat:1.0];
    basicAnimtion.toValue =  [NSNumber numberWithFloat:0.0];
    basicAnimtion.duration =  0.6;
    basicAnimtion.repeatCount =  HUGE_VALF;
    basicAnimtion.autoreverses = YES;
//    [_redView.layer addAnimation:basicAnimtion forKey:@"myCustomAnimation"];

=> it Is Work On diffrent Scaling And Transfering,Rotetation :

  CABasicAnimation *basicAnimtionToScale = [CABasicAnimation animationWithKeyPath:@"transform"];
    basicAnimtionToScale.fromValue = [NSValue valueWithCATransform3D:CATransform3DScale(_redView.layer.transform, 1.0, 1.0, 1.0)];
    basicAnimtionToScale.toValue =  [NSValue valueWithCATransform3D:CATransform3DScale(_redView.layer.transform, 2.0, 2.0, 2.0)];
    basicAnimtionToScale.duration =  0.6;
    basicAnimtionToScale.repeatCount =  HUGE_VALF;
    basicAnimtionToScale.autoreverses = YES;
//    [_redView.layer addAnimation:basicAnimtionToScale forKey:@"myScaleAnimation"];