1. Rotate the animation
cabasicanimation* rotationanimation;
Rotationanimation = [cabasicanimation animationwithkeypath:@ "Transform.rotation.z"];
Rotationanimation.tovalue = [NSNumber numberwithfloat:m_pi * 2.0];
[Camediatimingfunction Functionwithname:kcamediatimingfunctioneaseineaseout];
Rotationanimation.duration = 2;
Rotationanimation.repeatcount = 1000;//You can set to the maximum integer value
Rotationanimation.cumulative = NO;
Rotationanimation.removedoncompletion = NO;
Rotationanimation.fillmode = Kcafillmodeforwards;
[Self.image.layer addanimation:rotationanimation forkey:@ "Rotation"];
2. Zoom animation
Cabasicanimation *scaleanimation = [cabasicanimation animationwithkeypath:@ "Transform.scale"];
Scaleanimation.fromvalue = [NSNumber numberwithfloat:0.0];
Scaleanimation.tovalue = [NSNumber numberwithfloat:1.0];
Scaleanimation.duration = 1.0f;
Scaleanimation.timingfunction = [Camediatimingfunction functionwithname:kcamediatimingfunctioneaseineaseout];
Scaleanimation.removedoncompletion = NO;
Scaleanimation.fillmode = Kcafillmodeforwards;
[Self.image.layer addanimation:scaleanimation forkey:@ "scale"];
3. Changes in transparency
Cabasicanimation *opacityanimation = [cabasicanimation animationwithkeypath:@ "opacity"];
Opacityanimation.fromvalue = [NSNumber numberwithfloat:1];
Opacityanimation.tovalue = [NSNumber numberwithfloat:0];
Opacityanimation.duration = 2.0f;
Opacityanimation.removedoncompletion = NO;
Opacityanimation.fillmode = Kcafillmodeforwards;
[Self.image.layer addanimation:opacityanimation forkey:@ "opacity"];
4. Create animation groups, put the animation in a group to show
Caanimationgroup *animationgroup = [Caanimationgroup animation];
Animationgroup.duration = 2.0f;
animationgroup.autoreverses = YES; Whether to replay, the original animation of the reverse broadcast
Animationgroup.repeatcount = Nsnotfound;//huge_valf; Huge_valf, from MATH.H
[Animationgroup Setanimations:[nsarray arraywithobjects:rotationanimation, Scaleanimation, OpacityAnimation,nil];
Some simple animations for IOS