CABasicAnimation


    CABasicAnimation* anim =[CABasicAnimation animation];

   anim.keyPath= @"transform.scale.x";

   anim.fromValue = [NSNumber numberWithFloat:0.0];

   anim.toValue = [NSNumber numberWithFloat:2.0];

   

   anim.duration = 2.0;

   anim.repeatCount = 6;

   anim.autoreverses = YES;

   anim.timingFunction =[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];

   // [layeraddAnimation:anim forKey:@"change"];

   

   CABasicAnimation* anim1= [CABasicAnimation animation];

   anim1.keyPath= @"transform.scale.y";

   anim1.duration = 2.0;

   anim1.fromValue = [NSNumber numberWithFloat:1.0];

   anim1.toValue = [NSNumber numberWithFloat:3.0];

   anim1.repeatCount = 10;

   anim1.autoreverses = YES;

   

   // [layeraddAnimation:anim1 forKey:@"change1"];

   

   CABasicAnimation* anim2= [CABasicAnimation animationWithKeyPath:@"opacity"];

   anim2.duration = .3;

   anim2.autoreverses = YES;

   anim2.fromValue = [NSNumber numberWithFloat:0.0];

   anim2.toValue = [NSNumber numberWithFloat:1.0];

   anim2.timingFunction =[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];

   anim2.repeatCount = FLT_MAX;

   anim2.fillMode =kCAFillModeForwards;

   anim2.removedOnCompletion  =NO;

   

    [layeraddAnimation:anim2 forKey:@"change2"];

   

   

   CABasicAnimation* anim3= [CABasicAnimation animationWithKeyPath:@"transform.rotation"];

   anim3.repeatCount = 10;

   anim3.duration = 2.0;

   anim3.fromValue = [NSNumber numberWithFloat:1.0];

   anim3.toValue = [NSNumber numberWithFloat:(90*M_PI/180)];

   anim3.repeatCount = 10;

   anim3.autoreverses = YES;

   anim3.timingFunction =[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];

   

   //[layer addAnimation:anim3forKey:@"change3"];

   

   

   CABasicAnimation* anim4= [CABasicAnimation animationWithKeyPath:@"contents"];

   anim4.autoreverses =YES;

   anim4.repeatCount = FLT_MAX;

   anim4.fromValue = (id)[[UIImage imageNamed:@"page.png"]CGImage];

   anim4.toValue =(id)[[UIImage imageNamed:@"NormalTa.png"]CGImage];

   anim4.timingFunction =[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];

   anim4.removedOnCompletion = NO;

   anim4.fillMode =kCAFillModeForwards;

   

   anim4.duration = 3.0;

   

   

   //[layer addAnimation:anim4forKey:@"change100"];

   

   CABasicAnimation* anim5= [CABasicAnimation animationWithKeyPath:@"transform.translation.y"];

   anim5.toValue = [NSNumber numberWithFloat:150.0];

                 anim5.duration = 2.0;

   anim5.autoreverses = YES;

   anim5.repeatCount = FLT_MAX;

   anim5.timingFunction =[CAMediaTimingFunction   functionWithName:kCAMediaTimingFunctionEaseIn];

   anim5.removedOnCompletion    = NO;

   anim5.fillMode =kCAFillModeBoth;

   

    [layeraddAnimation:anim5 forKey:@"change5"];

你可能感兴趣的:(CABasicAnimation)