I'm trying to create a "reveal" effect from the bottom of an image. I thought it would be as simple as setting the anchorPoint to CGPointMake(0.5, 1.0) or the contentsGravity to kCAGravityTop, but none of these options works.
The current code I have works but animates from top to bottom. here's an idea of the reveal: http://giphy.com/gifs/xTiTnBzItdgaD1xHMc
How would I make this go from bottom-to-top ?
Here's the code
let path = UIBezierPath(rect: CGRectMake(0, 0, imgEmptyBase.width, imgEmptyBase.height - 80))
let mask = CAShapeLayer()
mask.anchorPoint = CGPointMake(0.5, 1.0)
mask.path = path.CGPath
imgEmptyBase.layer.mask = mask
let anim = CABasicAnimation(keyPath: "path")
anim.fromValue = path.CGPath
anim.toValue = UIBezierPath(rect: imgEmptyBase.bounds).CGPath
anim.duration = 1.0
anim.fillMode = kCAFillModeForwards
anim.removedOnCompletion = false
imgEmptyBase.layer.mask.addAnimation(anim, forKey: "anim")