Animating CIFilter CIPerspectiveCorrection


I’m trying to do an image cropping feature with perspective correction. I’ve had success with using CIFilter CIPerspectiveCorrection.

My question is: how do I animate from original image to my cropped image (with the correction)?

layer.filters is not supported for iOS as per documentation. I’m thinking maybe CATransform3D is the way to go, but I’m not familiar with transforms and matrices.

I’m looking for the same animation like cropping in CamScanner app.