I am trying to replicate iPhone Camera app default shutter animation.
Maybe anyone has tried doing that and have some hints to share?
Well, I found this somewhere:
     CATransition *shutterAnimation = [CATransition animation];
     [shutterAnimation setDelegate:self];
     [shutterAnimation setDuration:0.6];
     shutterAnimation.timingFunction = UIViewAnimationCurveEaseInOut;
     [shutterAnimation setType:@"cameraIris"];
     [shutterAnimation setValue:@"cameraIris" forKey:@"cameraIris"];
     CALayer *cameraShutter = [[CALayer alloc]init];
     [cameraShutter setBounds:CGRectMake(0.0, 0.0, 320.0, 425.0)];
     [self.layer addSublayer:cameraShutter];
     [self.layer addAnimation:shutterAnimation forKey:@"cameraIris"];
It's the default iPhone camera shutter animation.
And in Swift 3.0...
let shutterAnimation = CATransition.init()
shutterAnimation.duration = 0.6
shutterAnimation.timingFunction = CAMediaTimingFunction.init(name: 
kCAMediaTimingFunctionEaseInEaseOut)
shutterAnimation.type = "cameraIris"
shutterAnimation.setValue("cameraIris", forKey: "cameraIris")
let shutterLayer = CALayer.init()
shutterLayer.bounds = self.view.bounds
self.view.layer.addSublayer(shutterLayer)
self.view.layer.add(shutterAnimation, forKey: "cameraIris")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With