ios 前后摄像头翻转动画

create flip animation like rotate animation in native camera app


     CATransition *animation = [CATransition animation];    

animation.duration = .5f;    

animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];    

animation.type = @"oglFlip";    

if (captureDevice.position == AVCaptureDevicePositionFront) {

        animation.subtype = kCATransitionFromRight;    

}else if(captureDevice.position == AVCaptureDevicePositionBack){

        animation.subtype = kCATransitionFromLeft;    

}
    [capturePreviewLayer addAnimation:animation forKey:nil];


These are the CATransition types that are available:
kCATransitionFade 

kCATransitionMoveIn 

kCATransitionPush

kCATransitionReveal 

@"cameraIris" 

@"cameraIrisHollowOpen" 

@"cameraIrisHollowClose" 

@"cube" 

@"alignedCube" 

@"flip" 

@"alignedFlip" 

@"oglFlip" 

@"rotate" 

@"pageCurl" 

@"pageUnCurl" 

@"rippleEffect"
@“suckEffect"

Subtypes that are available are: 

kCATransitionFromRight 

kCATransitionFromLeft 

kCATransitionFromTop
kCATransitionFromBottom
    

    



你可能感兴趣的:(ios 前后摄像头翻转动画)