我正在使用AVFoundation创建带有自定义相机的iOS应用程序。 我的问题是相机旋转,预览层有改变前/后相机,如何生成动画像本机相机应用程序。 翻转动画?
谢谢,
答案 0 :(得分:4)
试试这个:
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];