Use of Camediatimingfunction
Camediatimingfunction can be used in the custom animation of pop animation, is a very useful tool, of course, the system animation is also available.
Effect:
Tools to use:
Https://github.com/YouXianMing/Tween-o-Matic-CN
Test using the source code:
////VIEWCONTROLLER.M//coreanimation////Created by Xianmingyou on 15/4/13.//Copyright (c) 2015 xianmingyou. All rights reserved.//#import "ViewController.h"@interfaceViewcontroller ()@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; //Initialize LayerCalayer *layer =[Calayer layer]; Layer.frame= CGRectMake ( -, -, $,2); Layer.backgroundcolor=[Uicolor Blackcolor]. Cgcolor; //End PositionCgpoint endposition = Cgpointmake (layer.position.x, LAYER.POSITION.Y + $); //AnimationCabasicanimation *animation = [cabasicanimation animationwithkeypath:@"position"]; Animation.fromvalue=[Nsvalue valueWithCGPoint:layer.position]; Animation.tovalue=[Nsvalue valuewithcgpoint:endposition]; Animation.timingfunction= [Camediatimingfunction functionwithcontrolpoints:0.20:0.03:0.13:1.00]; Layer.position=endposition; Animation.duration=1. F; //Add animations[layer addanimation:animation forkey:nil]; //Add Layer[Self.view.layer Addsublayer:layer];}@end
Details to be aware of:
Use of Camediatimingfunction